html code for email

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

href=" tags here"
Question by:lrbrister
    LVL 24

    Accepted Solution

    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=" tags&body=<b>this is important</b> This is not">send mail</a>

    Assisted Solution

    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='" + encodeURIComponent(body) + "'> Click </a>";
    document.write (mailLink);

    Open in new window

    LVL 7

    Assisted Solution

    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 ("")=2
                .Item ("")=""
                .Item ("")=25
                .Item ("")=cdoBasic
                .Item ("")="username"
                .Item ("")="password"
            end with
    set myMail=CreateObject("CDO.Message")
                with myMail
                    set .Configuration = cdoConfig
                        .From="""Parts Manager Tool"" <>"
                        .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

    All good answers with nod to first reply

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
    In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

    761 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

    8 Experts available now in Live!

    Get 1:1 Help Now