Solved

Sending HTML link via sendmail

Posted on 2000-03-02
7
218 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

910 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