Solved

Sending HTML link via sendmail

Posted on 2000-03-02
7
222 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

696 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