I am using standard MAPISession and MAPIMessage control in VB to send email from a COM DLL I wrote.
For some reason, it keeps locking up when it hits the send method of MAPIMessage. In addition, unless I have outlook already open, it would error out with "Unspecified Failure has occurred" when send method is called. What's more, if outlook is not open, it would wreck the Outlook profile as well (from tools -> Send/Receive menu, it says no Emails).
I have OL2K on Win2k (configured as Corporate Workgroup in order to use profile). I need to cater for users who are not using Exchange Server, however, still using workgroup settings by using normal SMTP email servers. These MAPI controls just don't work very well with Internet E-Mail account set up under Corporate workgroup.
The code is basically as follows:
With frmMAPI.MAPISession
.UserName = ProfileName
If .SessionID = 0 Then
.SignOn
End If
frmMAPI.MAPIMessages.SessionID = .SessionID
End With
With frmMAPI.MAPIMessages
.Compose
'.RecipIndex = 0
'.RecipAddress = EmailTo
.RecipDisplayName = EmailTo
.MsgSubject = Subject
.AttachmentIndex = 0
.AttachmentPathName = Attachment
.AttachmentType = 0 'attachment is a data file
'.Save
.Send
End With
LogOnUI is set to false, so is NewSession, and Download Mail.
Any idea what I can do? Am I better off calling MAPI32.dll functions direct, rather than relying on MAPI controls which seem to have lots of problems.
Thanks in advance
For some reason, it keeps locking up when it hits the send method of MAPIMessage. In addition, unless I have outlook already open, it would error out with "Unspecified Failure has occurred" when send method is called. What's more, if outlook is not open, it would wreck the Outlook profile as well (from tools -> Send/Receive menu, it says no Emails).
I have OL2K on Win2k (configured as Corporate Workgroup in order to use profile). I need to cater for users who are not using Exchange Server, however, still using workgroup settings by using normal SMTP email servers. These MAPI controls just don't work very well with Internet E-Mail account set up under Corporate workgroup.
The code is basically as follows:
With frmMAPI.MAPISession
.UserName = ProfileName
If .SessionID = 0 Then
.SignOn
End If
frmMAPI.MAPIMessages.SessionID = .SessionID
End With
With frmMAPI.MAPIMessages
.Compose
'.RecipIndex = 0
'.RecipAddress = EmailTo
.RecipDisplayName = EmailTo
.MsgSubject = Subject
.AttachmentIndex = 0
.AttachmentPathName = Attachment
.AttachmentType = 0 'attachment is a data file
'.Save
.Send
End With
LogOnUI is set to false, so is NewSession, and Download Mail.
Any idea what I can do? Am I better off calling MAPI32.dll functions direct, rather than relying on MAPI controls which seem to have lots of problems.
Thanks in advance