Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, iphone help, ipod help, AdSense, MySpace, Sony PSP help, Mp3 players, Windows XP, Windows Vista, Linux, SEO, Mac OS X, Facebook, Twitter and LinkedIn.

Can I have a mailto link specify a subject and body?

Dave, I have a email link on a web page. Set so when you click it, the email opens with the address and subject line populated. I want to have the cursor OR Hello show up in the Body of the email. I am told 'ONLY' with forms but I am sure I did this years ago. Here is what I have so far:

      "mailto:me@my-addr.com?Subject=Dear Kirk"

Do you know the code to finish it off?


Dave's Answer:

First off, I have two articles worth reading in this regard: Avoid spam by omitting mailto links and hiding email addresses in HTML forms.

If you still want to use a mailto: link, then it turns out that there's quite a rich language of different options you can specify to get the mailto link to work just as you desire.

According to what I found out about mailto links, you can specify more than one recipient by listing them as a comma-separated list (skip spaces, though), like this: mailto:joe@hisaddr.com,sue@heraddr.com,mary@heraddr.com. Easily done.

Now, for anything that would be passing additional information, you need to use the form ?name=value and if you specify more than one variable, you need to separate them with &, just as if you were specifying a method="get" form, actually.

So, to specify the subject, you already know that you use subject=something, but you can also specify the "Cc" or "Bcc" recipients with, logically enough, cc=some@addr.com, or bcc=someone@else.com.

Finally, and this is what you asked about in the first place, to specify the body of the message, use body=. In fact, you can apparently specify more than one line of the body by using body= more than one time in the URL. So, putting it all together:

mailto:larry,dan?cc=mike&bcc=sue&subject=test&body=type+your&body=message+here
Try that, see how it works for you!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Thanks for the useful information. But here I want to ask one more question. While mentioning "body=" I want to change the line. I used br tag of html for it but instead of breaking the line, the tag is displayed as it is. Is there any method to break the line while using "body="

Posted by: Amit Dua at September 17, 2005 4:07 PM

Amit, try using more than one body attribute, as shown in the very last example. It should let you break it into multiple lines. As you've found, you can't slip HTML into it, though, or you'll get the HTML source itself in the resultant message.

Posted by: Dave Taylor at September 17, 2005 9:50 PM

Hi Dave,

I hav ea small problem with the mailto link. How can I make the body content to be bold. Can you help me please.

Thanks.
Arun

Posted by: Arun at October 19, 2005 8:14 PM

Don't believe you can do that, Arun. Sorry.

Posted by: Dave Taylor at October 19, 2005 10:35 PM

oops!... :(

Anyway. Thanks for the help Dave. :)

Regards,
Arun

Posted by: Arun at October 20, 2005 9:23 PM

I'm trying to use multiple "body=" tags to break up the text but I always only get the text of the last one to appear in the email. What's wrong?

Posted by: Elise at November 11, 2005 12:39 AM

I think that multiple body= attributes is going to be supported by some Web browsers / email programs, but not others. I'd either experiment with more browser/OS/email combinations or just figure out how to have one really long body= attribute. Good luck!

Posted by: Dave Taylor at November 11, 2005 7:05 AM

%0A == line break in a mailto link

example HREF:

mailto:addy@gmail.com?subject=Some Kind Of Subject&body=Here is my email body and %0Aa %0Afew %0Aline %0Abreaks.

Posted by: alan at November 30, 2005 10:02 PM

Thank you, Alan, %0A works just fine to break the body into multiple lines of text in a mailto command.

Posted by: Ryan at July 28, 2006 1:36 PM

I have this mailto link that I'm trying to use:

and in the resulting Thunderbird compose msg window I get the output a) in the TO: address field, b) in the CC: adress field and c) in the msg body:

a) someone@someadd.com
b)someoneelse"@someotheradd.com?subject=some subject?body=Hello+you!
c)Thanks for0%Anice0�������������������������

Posted by: Rawd at November 7, 2006 6:14 PM

Thank you! very well explained and functional!

Posted by: Lauren at January 27, 2007 7:36 AM

This doesnt seem to work in IE7. What is the deal with IE7, is this a known problem, and is there a fix? please help!

Posted by: Mike M at January 31, 2007 2:43 PM

Sir,

How can i use charchetr "&" inside body?

If i use inside the body , It will take automatically as separator.

Posted by: Mathan at March 1, 2007 6:57 PM

I have to insert a URL in the body of a mail using mailto tag. What I am getting is just the plain text and not the hyperlink in the body.
Are there any attributes for this in the bosy tag?
can you help me with this?

Thanks.

Posted by: Harshad at March 13, 2007 1:30 AM

using extra body tags doesn't work to create new lines for me on Mac Mail program

Posted by: Adam at March 29, 2007 12:19 PM

hi,
i am using mailto:someone@somewhere.com?Subject=something

While this seems to work fine for mail editors such as outlook the subject doesn't get recognized in gmail or yahoo.is there a work around??

Thanks,
Chaitanya

Posted by: chaitanya at June 1, 2007 3:31 AM

Hi,

I need to display the test within "" inside the body of the mail using mailto tag..


can you help me..

Posted by: karthik at October 4, 2007 3:32 AM

I see a lot of questions concerning sneaking HTML into the mail, for example hyperlinks and making text bold. I'd say that this is by defintion impossible, because you're making a TEXT email. No mark-up whatso-ever...

Posted by: mvdv at February 26, 2008 2:56 AM

Hi! Can you please help me. I need to pass the body of mailto: from a textbox. Is this possible? I'm using ASP.Net. Can you please send me the code if possible. Thank you so much in advance.

Posted by: Ronaldo at April 30, 2008 11:42 AM

I have to insert a URL in the body of a mail using mailto tag. What I am getting is just the plain text and not the hyperlink in the body.

Posted by: vinod at May 9, 2008 1:04 AM

Hi,

Is this format supposed to work for Macs?

thanks,
Aju

Posted by: Aj at May 23, 2008 11:44 AM


I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Member of the B5Media Network

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]