Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CDO Email from .ASP Put Hyperlink in HTMLBody

Posted on 2003-12-02
5
Medium Priority
?
1,134 Views
Last Modified: 2008-02-01
This should be simple.  I'm using CDO to send email messages to our staff when a user submits a form via ASP, it sends an email to their manager and tells them to go to a page to review.  I'd like to include in the body of the email a hyperlink to the page they use to update the data.  I can't seem to get it correct.  The message sends fine, but I haven't been successful putting a hyperlink in the message body.  

Any suggestions?

Thanks as always !

0
Comment
Question by:BetsyV
5 Comments
 
LVL 4

Expert Comment

by:ainapure
ID: 9861940
please post the code u have so far

-amit
0
 
LVL 20

Expert Comment

by:jitganguly
ID: 9862034
You have to use bodyformat=0

Here is a sample from MSDN

Try putting hyperlink here and see

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
 
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
HTML = HTML & "<title>Sample NewMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body>"
HTML = HTML & "This is a sample message being sent using HTML. <BR></body>"
HTML = HTML & "</html>"
 
myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing
0
 

Assisted Solution

by:kkkani
kkkani earned 500 total points
ID: 9862165
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title></title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=#FFFFFF>"
HTML = HTML & "<a href=www.yahoo.com>Click Here</a>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
mail_type = 0


Dim objNewMail
Set objNewMail = CreateObject("CDONTS.NewMail")
objNewMail.From = "test@test.com"
objNewMail.To =  "test@microsoft.com"
objNewMail.Subject = "test"
objNewMail.BodyFormat = 0
objNewMail.MailFormat = 0
objNewMail.Body = HTML
objNewMail.Send
Set objNewMail = Nothing
0
 
LVL 1

Accepted Solution

by:
Jimby_Aus earned 500 total points
ID: 9865034
You may prefer to use CDO/CDOSYS as opposed to the outdated CDONTS library.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp

Just make sure you use the

.HTMLBody

Property, not the .TextBody.
Regards,

Jimby_Aus.
0
 

Author Comment

by:BetsyV
ID: 9867244
Thanks as always.  I am using CDO/CDOSYS, but I had the format to my hyperlink wrong (it had quotes around it <a href=".....">.  That messed everything up.  I split the points because I got the correct format from one message, and knew I had the rest correct based on the suggestion to use .HTMLBody.

I should have put a sample of my code in my original message.  That would have made it more obvious.

Thanks for the help !
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

783 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