Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

CDO.Message

Posted on 2003-10-30
7
65,367 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 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