Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO - OutLook AND Outlook Express?

Status
Not open for further replies.

Glasgow

IS-IT--Management
Joined
Jul 30, 2001
Messages
1,669
Location
GB
I have coded some logic (CDO 1.21) to send emails from my application and this works fine under Windows XP with Outlook. However, my hope was that the code would work equally well for Outlook Express and under any Windows flavour from Windows 98 onwards.

An extract from code is as follows:

If MailLink Is Nothing Then
Set MailLink = CreateObject("MAPI.Session")
MailLink.Logon
End If
Set Msg = MailLink.Outbox.Messages.Add
Set WhoTo = Msg.Recipients.Add(EmlAddress)
Msg.Subject = EmlSubject
Msg.Text = EmlText
Msg.Attachments.Add NewName, , , NewName
Msg.Update

It fails creating the MAPI session when Outlook express is default email client("current mail client cannot fulfill the messaging request"). Unless I can resolve this issue, there is little point in testing under other Windows versions. Am I being too ambitious?

Thanks in advance.
 
OK Jeff thanks.


seems to concur:

"Outlook Express does not provide any support for CDO 1.21 or for Extended MAPI."

and another revelation:

"There is another complication with using CDO 1.21 in that your Microsoft® Visual Basic® application cannot re-distribute CDO 1.21. The two main supported ways to install CDO 1.21 are the setup process of regular Outlook and the Exchange Server 5.5 Administrator utility."

I am developing an application that is likely to be used by "the general public" who could have different email clients (though I am happy to restrict to Outlook AND Outlook express), different Windows versions and I'd certainly prefer not to force them to load components from CDs other than any we ship with the product.

Any suggestions as to how I might go about achieving this?
 
The VB MAPI controls will work with both Outlook and Outlook Express.

There are numerous non-mapi clients in use, some of which have programmable interfaces and some not. You will probably have to determine the default mail client from the registry and if not supported, disable the e-mail functions in your application.

Paul Bent
Northwind IT Systems
 
Thanks Paul - my research this morning has suggested the same route - i.e. MAPI controls. All going reasonably well - I just have to address the fact that messages are being saved in Outlook Express InBox (I want Outbox) and Outlook spits back 'Unspecified failure has occurred' on the .Save (or a .Send). I'd prefer to Save and leave the sending to the user.

The code looks like this:

Dim MpsMail As MAPISession, MpsMsg As MAPIMessages, NewName As String
Set MpsMail = FrmOut.MAPISession
Set MpsMsg = FrmOut.MAPIMessages

With MpsMail
If .SessionID = 0 Then
.LogonUI = True
.DownLoadMail = False
.SignOn
End If
End With
With MpsMsg
.SessionID = MpsMail.SessionID
.Compose
.RecipAddress = EmlAddress
.MsgSubject = EmlSubject
.MsgNoteText = EmlText
.Save
End With

Any ideas?
 
I have overcome the OutLook problem by ensuring that the .RecipDisplayName property is set to something but all messages still being created in InBox.
 
It appears that I may not be able to get around my InBox problem. The documentation states:

Successfully logging into a MAPI session accesses the Inbox of the registered user specified by the UserName and Password properties of the MAPISession control. The Inbox is the message store. When the Inbox is opened two buffers are created: the compose buffer and the read buffer.

Which suggests I have access only to the InBox. Sigh!

I can use the .Send method to send the message directly but I really do not want to do this - not least because this triggers a virus alert that seeks confirmation from the user for each mail sent - not ideal when I am sending multiple emails within a loop. As previously stated, I also want the user to have control over when/whether messages are actually sent.

Any suggestions for workarounds would be appreciated. CDO presents barriers (no Outlook Express support) and now, apparently, so do the MAPI controls (no access to outbox). I think I may be running out of options.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top