Solved

Sending HTML link via sendmail

Posted on 2000-03-02
7
220 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtual SQL Server 2014 Standard 35 87
SQL STANDARD CORE 6 29
NOLOCK still valid for 2014? 5 35
query question 12 32
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

790 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