Learn how to a build a cloud-first strategyRegister Now


html code for email

Posted on 2012-09-20
Medium Priority
Last Modified: 2012-09-20
is there a way to use the following code but make the body HTML?

href="mailto=lrbrister@mydomain.com&subject=Test&body=Html tags here"
Question by:lrbrister
LVL 24

Accepted Solution

mankowitz earned 1200 total points
ID: 38417960
unfortunately, that totally depends on the mail client. Some will honor the tags and some won't there is no industry standard for that.

For example, this doesn't work in outlook

<a href="mailto:dog@bark.com?subject=html tags&body=<b>this is important</b> This is not">send mail</a>

Assisted Solution

_lobo earned 400 total points
ID: 38417981
no, this is not possible by just using plain HTML, but you can use javascript for basic formatting like line breaks (see this quick and dirty example)



<script type="text/javascript">
var body = "FirstLine \n Second Line";
var mailLink = "<a href='mailto:test@example.com?body=" + encodeURIComponent(body) + "'> Click </a>";
document.write (mailLink);



Open in new window


Assisted Solution

dimmergeek earned 400 total points
ID: 38417988
I do not think it's possible to embed HTML in your e-mail with a mailto: link.
If you're using ASP.NET, you can set a a variable to be a string of HTML.

I've had success doing this:

dim cdoConfig, myMail, message

set cdoConfig = CreateObject("CDO.Configuration")
            with cdoConfig.Fields
            .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
            .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="your.mail.server.here"
            .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
            .Item ("http://schemas.microsoft.com/cdo/configuration/cdoSMTPAuthenticate")=cdoBasic
            .Item ("http://schemas.microsoft.com/cdo/configuration/cdoSendUserName")="username"
            .Item ("http://schemas.microsoft.com/cdo/configuration/cdoSendPassword")="password"
        end with

set myMail=CreateObject("CDO.Message")
            with myMail
                set .Configuration = cdoConfig
                    .From="""Parts Manager Tool"" <return@address.com>"
                    .Subject="SQL-Parts Issue for Investigation | Part Number:  " & rsObj("Part Number")
                    .HTMLBody="<p>A part issue has been identified by the production team and requires your assistance. Please investigate the validity of this issue.</p><br /><br />Thank you."
            end with

Open in new window


Author Closing Comment

ID: 38418007
All good answers with nod to first reply

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

810 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