Solved

Sending HTML link via sendmail

Posted on 2000-03-02
7
216 Views
Last Modified: 2012-06-27
Working on a project that brings up a form dependent on the criteria that the user inputs.  Am capturing this data in order to send email to another user that will point in to this same form.  The hyperlink will change for each user depending on what path they need to follow.
I need to find a way to send a hyperlink thru the sendmail funcion.
So far it looks like all I can send is text, but I need the link to be 'clickable' so the user can go directly from their mail to the page.  I know how to do it in an ASP page, but we need this functionality thru SQL for other aspects of the project.  Any ideas?
0
Comment
Question by:cglaser
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:vujos
ID: 2578741
Hi,

Use option

MyMail.BodyFormat = 0 (for HTML)
MyMail.BodyFormat = 1 (for TEXT)



For example :

Set myMail = CreateObject("CDONTS.NewMail")  
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>" HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "HTML = HTML & ""content=""text/html; charset=iso-8859-1"">"""
HTML = HTML & "<title>Sample Mail</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@Company.com" myMail.Subject = "Sample Message"
myMail.BodyFormat = 0 myMail.MailFormat = 0 myMail.Body = HTML myMail.Send
Set myMail = Nothing


Some of the sites to visit (one of them is source of the above code)

http://www.activeserverpages.ru/iishelp/iis/htm/asp/amsm0qzj.htm
 
http://www.15seconds.com/Issue/980325.htm
 
http://www.zdjournals.com/asp/9906/asp9961.htm
 
http://www.aspzone.com/articles/john/HowToSendEmail/HowToSendEmail.asp
 
http://www.aspalliance.com/wsk/aboutemail.asp


Hope this helps.
0
 
LVL 1

Accepted Solution

by:
vujos earned 100 total points
ID: 2578745
Hi,

Above source code is not to nice so :

Hi,

Use option

MyMail.BodyFormat = 0 (for HTML)
MyMail.BodyFormat = 1 (for TEXT)



For example :

Set myMail = CreateObject("CDONTS.NewMail")  
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>" HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "HTML = HTML & ""content=""text/html; charset=iso-8859-1"">"""
HTML = HTML & "<title>Sample Mail</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@Company.com" myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing

Hope this helps.
0
 
LVL 2

Expert Comment

by:kubeerja
ID: 2581006
EXEC xp_sendmail 'kubeerja', 'http://www.yahoo.com'
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:cglaser
ID: 2583380
That's exactly what I needed!

Christy
0
 
LVL 2

Expert Comment

by:kubeerja
ID: 2583439
Christy

I don't know what is the relation between your question and the answer and SQL server.

can you explain!!!!!
0
 

Author Comment

by:cglaser
ID: 2588879
The answer that was given can be inputed into the trigger that will fire when the database is updated.  I had a trigger that would fire a text email to the designated user, but I needed one that would format the message in HTML so that the links that were sent would be 'clickable'.  The above answer gives me this option.
Does that help?? :)

Christy
0
 
LVL 2

Expert Comment

by:kubeerja
ID: 2589602
I know that this code can send an HTML mail may be in VB or in ASP, but I wonder how you can run it from a trigger. As far as I know I don't think you can use CreateObject in MS SQL procedure or trigger, unless you are working with a different SQL server. You can call com objects from a stored proc but not in this way.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

707 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

20 Experts available now in Live!

Get 1:1 Help Now