Why use an installed client when you can use the DotNet infrustructure,
which has it all built in?
'xxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xx
'SMTP EMAIL NOTES
'As condensed from:
http://www.systemwebmail.com/default.aspx
'1. Have a reference set to the System.Web.dll.
'2. Have "Imports System.Web.Mail " statement at the top of your code.
'3. SmtpMail.SmtpSe rver must allow relaying for FROM email address or your
IP address,
' or you must use dotNET 1.1 or higher to authenticate.
'SAMPLE SETTINGS
'Dim emlEmail As New System.Web.Mail .MailMessage()
' NOTE: all email addresses can be like: "my******** @my-domain.com" - OR -
Fully named like: """John Smith"" <my********@m y-domain.com>"
' Also, multiple email addresses can be sent separated by semi-colon
character.
'emlEmail.To = "my******** @my-domain.com"
'emlEmail.From = "my******** @my-domain.com"
'emlEmail.Cc = "my******** @my-domain.com" 'optional
'emlEmail.Bcc = "my******** @my-domain.com" 'optional
'emlEmail.Subje ct = "SUBJECT_HE RE"
'emlEmail.BodyF ormat = MailFormat.Html
'emlEmail.Body = "BODY OF THE MESSAGE HERE"
'emlEmail.Heade rs.Add("Reply-To", "my******** @my-domain.com")
'Attachments()
'Dim attachment As New System.Web.Mail .MailAttachment ("C:\Foo.xls ") 'create
the attachment
'emlEmail.Attac hments.Add(atta chment) 'add the attachment
'Authentication cannot be done using the .NET Framework 1.0. Must use 1.1 or
higher.
'emlEmail.Field s.Add("http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e",
"1") 'basic authentication
'emlEmail.Field s.Add("http://schemas.microso ft.com/cdo/configuration/sendusername",
"my_username_he re") 'set your username here
'emlEmail.Field s.Add("http://schemas.microso ft.com/cdo/configuration/sendpassword",
"super_secr et") 'set your password here
'SmtpMail.SmtpS erver = "EMAIL_SERVER_D OMAIN" 'your real server goes here
'SmtpMail.Send( emlEmail)
'xxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xx
Please note that the above example is for DotNet 1.x
http://www.systemwebmail.com/
To see more information for 2.x, see
http://www.systemnetmail.com/
I have found these two sites very useful.
HTH.
Cheers!
~ Duane Phillips.
<se******@gmail .comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
>I am using the following code for sending email through mapi in VS 2005
environment:
Public objSession As New MSMAPI.MAPISess ion
Public objMessage As New MSMAPI.MAPIMess ages
objSession.Down LoadMail = False
objSession.User Name = "MyUsername "
objSession.Pass word = "MyPassword "
objSession.Sign On()
objMessage.Sess ionID = objSession.Sess ionID
objMessage.Comp ose()
objMessage.Reci pAddress = txtTo.Text
objMessage.Text = txtBody.Text
objMessage.Subj ect = txtSubject.Text
objMessage.Send (True) 'ShowDialog
MsgBox("Message sent successfully!")
objSession.Sign Off()
I uninstalled Microsoft Outlook (comes along with msoffice), now my
default client is Outlook Express, I get this exception:
An unhandled exception of type
'System.Runtime .InteropService s.COMException' occurred in
mailclient.exe
Can anybody help me out ?
Regards,
Sentiboy