Solved

CDO.Message

Posted on 2003-10-30
7
65,336 Views
Last Modified: 2012-05-07
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.
0
Comment
Question by:Isaac
7 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9653565
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!!
0
 
LVL 4

Accepted Solution

by:
kblack15217 earned 500 total points
ID: 9653567
if this is really CDO.Message, then you need to change

objSendMail.TextBody to objSendMail.HTMLBody

You dont need the mailformat or body format calls.  Get rid of them.

0
 
LVL 4

Expert Comment

by:kblack15217
ID: 9653573
setting the .TextBody of CDOSYS will always send the email as text.  
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9653577
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
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9653580
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!!
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9653586
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!!
0
 
LVL 19

Expert Comment

by:Dexstar
ID: 9653633
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*
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now