Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag for United States of America

asked on

CDO.Message

bodyTxt = "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"

emailHere = "iola@eecom.com"
Set objSendMail = CreateObject("CDO.Message")
objSendMail.Subject = "Your Certificate"
objSendMail.MailFormat = 0
objSendMail.BodyFormat = 0
objSendMail.From = "iola"
objSendMail.To = emailHere
objSendMail.TextBody = bodyTxt
objSendMail.send

When the email is sent, the recepient receives the contents of bodyTxt with the HTML tags exactly as you see it above.  Also, the link "Please click here" is not active.

Any solutions.
Avatar of ap_sajith
ap_sajith

Try

bodyTxt = "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"

emailHere = "iola@eecom.com"
Set objSendMail = Server.CreateObject("CDONTS.NEWMAIL")
objSendMail.Subject = "Your Certificate"
objSendMail.MailFormat = 0
objSendMail.BodyFormat = 0
objSendMail.From = "iola"
objSendMail.To = emailHere
objSendMail.TextBody = bodyTxt
objSendMail.send

Cheers!!
ASKER CERTIFIED SOLUTION
Avatar of kblack15217
kblack15217

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
setting the .TextBody of CDOSYS will always send the email as text.  
Avatar of fritz_the_blank
From Microsoft:

Dim iMsg
Set iMsg = CreateObject("CDO.Message")

With iMsg
  .To         = "someone@microsoft.com"
  .Newsgroups = "comp.microsoft.newsgroup1"
  .Subject    = "Agenda for staff meeting"
  .HTMLBody   = "<html><body><p>Please plan to present your status for the following projects...</p></body></html>"
End With


FtB
If you wanna use CDOSYS,
use..
bodyTxt = "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"

Set objSendMail = CreateObject("CDO.Message")

With objSendMail
 .To         = "someone@microsoft.com"
 .Newsgroups = "comp.microsoft.newsgroup1"
 .Subject    = "Agenda for staff meeting"
 .HTMLBody   = bodyTxt
End With


Cheers!!
Correction on sending the mail using the NEWMAIL Object.. Here's the correct code.

bodyTxt = "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"

emailHere = "iola@eecom.com"
Set objSendMail = Server.CreateObject("CDONTS.NEWMAIL")
objSendMail.Subject = "Your Certificate"
objSendMail.MailFormat = 0
objSendMail.BodyFormat = 0
objSendMail.From = "iola"
objSendMail.To = emailHere
objSendMail.Body = bodyTxt
objSendMail.send

Cheers!!
TheInnovator:

Perhaps your HTML isn't properly formatted.  Change this:

bodyTxt = "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"

To This:
bodyTxt = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
bodyTxt = bodyTxt & "<html>"
bodyTxt = bodyTxt & "<head>"
bodyTxt = bodyTxt & "<meta http-equiv=""Content-Type"""
bodyTxt = bodyTxt & ""content=""text/html; charset=iso-8859-1"">""
bodyTxt = bodyTxt & "<title>Sample NewMail</title>"
bodyTxt = bodyTxt & "</head>"
bodyTxt = bodyTxt & "<body>"
bodyTxt = bodyTxt & "<span>You have just received an email from security.<br> <a href='http://registration/se/Rest.asp?var=" & request.form("id") & "&email=" & email & "'>Please click here.</a></span>"
bodyTxt = bodyTxt & "</body></html>"

If you want more information, here is a link that says exactly how to do it:
     http://www.15seconds.com/issue/980429.htm


Hope that helps,
Dex*