Hi
I’m trying to write some VB code to send an email where the body is formatted in HTML (with the aim of including a hyperlink in the body eventually once I get it working), but it’s not working, in that I get no email being generated. The code is updated in Visual Studio 6.
Here’s the email code I’m using:
Set objMail = New MailSender
objMail.Host = sMailHost
objMail.From = sMailFrom
objMail.AddAddress sMailRecipient
objMail.Subject = "Dummy email subject" '& ": " & sFilename
objMail.MailFormat = objMail.olFormatHTML
objMail.BodyFormat = objMail.olFormatHTML
objMail.HTMLBody = "<html>Test email format HTML</html>"
objMail.Send
Set objMail = Nothing
I added the MailFormat and BodyFormat settings based on what I found from searching Google. I've also tried setting them to values of 0 and 2, as also suggested on Google.
I know the email process works, because if I change it to normal text format in the same program it does work, like this:
Set objMail = New MailSender
objMail.Host = sMailHost
objMail.From = sMailFrom
objMail.AddAddress sMailRecipient
objMail.Subject = "Dummy email subject" '& ": " & sFilename
objMail.Body = "Test email format normal"
objMail.Send
Set objMail = Nothing
Any suggestions how to get the HTML version of the email working would be greatly appreciated.
Thanks
Moose
I’m trying to write some VB code to send an email where the body is formatted in HTML (with the aim of including a hyperlink in the body eventually once I get it working), but it’s not working, in that I get no email being generated. The code is updated in Visual Studio 6.
Here’s the email code I’m using:
Set objMail = New MailSender
objMail.Host = sMailHost
objMail.From = sMailFrom
objMail.AddAddress sMailRecipient
objMail.Subject = "Dummy email subject" '& ": " & sFilename
objMail.MailFormat = objMail.olFormatHTML
objMail.BodyFormat = objMail.olFormatHTML
objMail.HTMLBody = "<html>Test email format HTML</html>"
objMail.Send
Set objMail = Nothing
I added the MailFormat and BodyFormat settings based on what I found from searching Google. I've also tried setting them to values of 0 and 2, as also suggested on Google.
I know the email process works, because if I change it to normal text format in the same program it does work, like this:
Set objMail = New MailSender
objMail.Host = sMailHost
objMail.From = sMailFrom
objMail.AddAddress sMailRecipient
objMail.Subject = "Dummy email subject" '& ": " & sFilename
objMail.Body = "Test email format normal"
objMail.Send
Set objMail = Nothing
Any suggestions how to get the HTML version of the email working would be greatly appreciated.
Thanks
Moose
Comment