-
Send Email in VB
Hi All,
In my application, i need to send out email automatically. I have the email address and context ready. So i don't need any interface. Is there a function in VB , kind of like msgbox, instead of sending message to screen or file, i can send an email message to a specified address. Thanks .
-
You can either use MAPI or winsock and send commands to a email server...
-
MAPI code
With MAPISession1
.SignOn
End With
With MAPIMessages1
.SessionID = MAPISession1.SessionID
.Compose
.RecipAddress = "[email protected]" 'used during test phase
.MsgSubject = "New REP file loaded"
.MsgNoteText = "New REP file '" & txtOutputFile & "' has been saved to " & repOutputPath & Chr(13) & "There were " & repErrorsCorrected & " error(s) corrected"
.ResolveName
.Send False
End With
add the MAPI controls to your project.///
-
Thanks a lot, chenko. I will try your code .
-
ignore the "'used durning test phase" that was just a peice of my code copied.
-
Chenko,
I got problem when i was trying your code. For .logon statement, i got error message:" Error in Loading MAPI DLL". I looked at microsoft's website for this error. It says "Direct Mail Manager" needs to be installed. Is that ture? Another thing, before .logon, should i specify the server name, username, password, etc.? Thanks in advance.