Send email using MAPI with Vista?

merkin51

New member
Joined
Feb 21, 2008
Messages
3
Programming Experience
Beginner
I have a Windows application which needs to send an email using the users default email handler. The application will be used by a wide variety of people so I can't use an SMTP server, hence the use of MAPI. My code works fine in XP with Outlook, but I'm getting no response in Vista at all:

VB.NET:
Try

Dim Session As New MSMAPI.MAPISession
Session.LogonUI = True
Session.DownLoadMail = False
Session.SignOn()
Dim Messages As New MSMAPI.MAPIMessagesClass
Messages.SessionID = Session.SessionID
Messages.Compose()
Messages.RecipDisplayName = "emailaddress@email.com"
Messages.MsgNoteText = "Text in message body"
Messages.MsgSubject = "Email subject"
Messages.AttachmentIndex = 0
Messages.AttachmentPosition = 0
Messages.AttachmentPathName = sFileName
Messages.ResolveName()
Messages.Send(True)
Session.SignOff()

Catch
End Try

The code should open a new mail message with an attachment, ready for the user to send. Any ideas why this doesn't work in Vista? Should MSMAPI be compatible with Windows Mail?

Thanks in advance!
Tim
 
Back
Top