View Single Post
  #6 (permalink)  
Old December 11th, 2013, 07:40 AM
arindam46 arindam46 is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending Mail Using MAPI

When i try to send a mail using the below mentioned code an exception occurs on sign on that "Error in loading MAPI DLL". Now when i try add mapi32.dll as a reference by browsing it form c:\Windows\System32\mapi32.dll it cannot be added as a reference showing that it is not a valid COM component. So what should i do to SignOn in the code mentioned below.

Dim mapisession1 As New MSMAPI.MAPISession
Dim MAPIMessages1 As New MSMAPI.MAPIMessages
mapisession1.LogonUI = True
'mapisession1.UserName = "abc@gmail.com"
'mapisession1.Password = "**********"
mapisession1.SignOn()
With MAPIMessages1
.SessionID = mapisession1.SessionID
.Compose()
.MsgSubject = "test"
.RecipIndex = 0
.RecipAddress = "xyz@yahoo.co.in"
.ResolveName()
.MsgNoteText = "Here You go"
'.AttachmentIndex = 0
'.AttachmentPosition = 0
'.AttachmentPathName = strFilePath

.Send()
End With
mapisession1.SignOff()
Reply With Quote