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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPI controls causing all sorts of problems

Status
Not open for further replies.

CW2002

Programmer
Jun 28, 2002
16
AU
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top