How to Create and Configure the HTML MailTo in Your Webpage:
For sending an email, three main fields are required. They are:
1) The email address of the person to whom the email has to be sent,
2) The subject,
3) The body of the email.
In addition to the above three fields, fields like Cc(Carbon Copy), Bcc(Blind Carbon Copy), etc can also be included.
To embed the mailto function in the webpage:
1) Creating the mailto attribute:
Create a mailto attribute inside an anchor tag. Place this inside the body tags of the webpage.
<a href="mailto:firstname.lastname@example.org">Send Feedback </a>
This will create a link that will open the email client, that will have the address field filled with the email address (in our case it is email@example.com)
2) Entering the subject in the subject field:
Moving on to the next step, we'll add the subject in the subject field.
<a href ="mailto:firstname.lastname@example.org?subject=I am an email sent from the mailto link ">Send your Feedback</a>
Enter the 'subject' keyword followed by the '?' symbol. The '?' symbol separates the email address from other information. The subject keyword is followed by a '=' (equals to) operator after which the subject is entered.
3) Entering Information in the Body, Cc, Bcc Fields:
Once the subject is entered, information for other fields like body, Cc and Bcc are entered with their appropriate keywords preceded by a '&'.
&body=I am the body of the email that you are sending as a feedback
<a href ="mailto:email@example.com?subject=I am an email sent from the mailto link&body=I am the body of the email that you are sending as a firstname.lastname@example.orgemail@example.com ">Send your feedback.</a>
Quick Guide to Understand the Code:
<a href ="mailto:email_id_of_the_owner_of_the_webpage?subject=enter_the_subject&body=enter_the_body_field&cc=carboncopy&bcc=blindcarboncopy">Text to be displayed on the webpage.</a>