Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set subject/content of email using mailto:?

Tags:

html

email

mailto

Is it possible to set the subject/content of email when I use mailto:?

like image 552
Jiew Meng Avatar asked Jan 24 '11 12:01

Jiew Meng


People also ask

How do you put a subject line in an email link?

To create a link to send email, use <a> tag, with href attribute. The mail to link is added inside the <a> tag. To add a subject, you need to add ? and then include the subject. All this comes inside the <a> tag.

How do I create a pre filled email link?

On the Insert tab, click Link or Hyperlink. Under Link to, click E-mail Address. Either type the email address that you want in the E-mail address box, or select an email address in the Recently used e-mail addresses list. If you want to change the link text, in the Text to display box, type the text.


2 Answers

Yes, look all tips and tricks with mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm

mailto subject example:

<a href="mailto:[email protected]?subject=free chocolate">example</a>

mailto with content:

<a href="mailto:[email protected]?subject=look at this website&body=Hi,I found this website and thought you might like it http://www.geocities.com/wowhtml/">tell a friend</a>

As alluded to in the comments, both subject and body must be escaped properly. Use encodeURIComponent(subject) on each, rather than hand-coding for specific cases.

As Hoody mentioned in the comments, you can add line breaks by adding the following encoded sequence in the string:

%0D%0A // one line break 
like image 79
Haim Evgi Avatar answered Sep 24 '22 07:09

Haim Evgi


<a href="mailto:[email protected]?subject=Feedback for  webdevelopersnotes.com&body=The Tips and Tricks section is great &[email protected] &[email protected]">Send me an email</a> 

you can use this code to set subject, body, cc, bcc

like image 33
Simer Twilio Toronto developer Avatar answered Sep 25 '22 07:09

Simer Twilio Toronto developer