HTML 'mailto' with subject and multi-line body example ~ Web CodeHelpers

HTML 'mailto' with subject and multi-line body example

In this article i am going to explain about HTML mailto link with structured body



mailto link will use the html anchor tag

sample code
<a href="mailto:help@webcodehelpers.com">Send Mail</a>


to use mailto link in advanced we will use the below notions

NotationMeaning  (for understanding purposes)
?Appears just after the email address, separating it from the first name/value pair.
=Separates each name and value, in the form  name=value.
&Separates name/value pairs, as in  name1=value1&name2=value2.
%Precedes an ASCII character code in hexadecimal, in the form  %xx,  as a way of representing that character. For example,  %0A   represents a newline (line feed) character.
+Another way to represent a space. For example, the value  Bjorn Free  could appear in the URL as   Bjorn+Free.

mailto with cc and bcc - sample code below 

<a  href="mailto:help@webcodehelpers.com?CC=mail1@example.com&BCC=mail2@example.com&Subject=Mail%20with%20CC%20and%20BCC">Send Mail</a>


Live Demo : Send Mail

mailto with subject - sample code below 

<a href="mailto:help@webcodehelpers.com?Subject=Code Help" target="_top">
Send Mail</a>


Live Demo : Send Mail

mailto with subject and body  - sample code below


<a href="mailto:help@webcodehelpers.com?Subject=Code Help&body=Mail Body" target="_top">
Send Mail</a>


Live Demo : Send Mail

the above two scenarios will work for us all most , but some times we need to send the structured  body data like below

Hello "Name" We are very happy for visiting our website webcodehelpers.com portal, which is providing useful information , code snippets and live examples. We also providing Interview tip to all the freshers in web development and experienced people also Thanks, WebCodeHelpers.com Team
To achieve the above scenarios we need to use the HTML URL Encoding References
HTML URL Encoding References for Space  == %20
HTML URL Encoding References for New Line (Line Feed)  == %0A

mailto with subject and structured body sample code

<A HREF="mailto:help@webcodehelpers.com?Subject=Help&Body=Hello%20%22Name%22%0A%0AWe%20are%20very%20happy%20for%20visiting%20our%20website%20webcodehelpers.com%20portal%2C%20which%20is%20providing%20useful%20information%20%2C%20code%20snippets%20and%20live%20examples.%0A%0AWe%20also%20providing%20Interview%20tip%20to%20all%20the%20freshers%20in%20web%20development%20and%20experienced%20people%20also%0A%0A%0AThanks%2C%0AWebCodeHelpers.com%20Team">Check Mail</A>


Live Demo  : Check Mail


* Please Like page to promote us
* Please leave your feedback as comments

1 comments :

Subscribe updates via Email