Summary -
In this topic, we described about the Email Links topic in detail.
It is not best practice to specify the emailId directly on the HTML which might cause of spamming the mailbox. There are actually two ways to specify the email links on HTML page.
- HTML Forms
- HTML Email Links
HTML forms can be discussed in further topics or Visit HTML Forms here.
The best example for the HTML forms in our shop are the contact us form. Visit Contact us form here.
Email links that activates mail client on computer for sending mails. Mailto attribute is used to send the mails. Mailto attribute provides as part link tag(<a>). The web browser requires the mail client should install on the computer to send mail.
Syntax -
<a href="mailto:TOMailid@email.com">Send Mail</a>
The above code will generate a link on HTML page. If user clicks on the link, it launches the email client which is installed on the specific computer where the user clicked the link.
If the any email client is not installed on the machine, then it is not possible to send the email from the specific machine.
Parameter | Description |
---|---|
mailto:TOMailid@email.com | e-mail recipient address |
cc=CCMailid@email.com | carbon copy e-mail address |
bcc=BCCMailid@email.com | blind carbon copy e-mail address |
subject=subject text | subject of e-mail |
body=body text | body of e-mail |
? | first parameter delimiter |
& | other parameters delimiter |
Example1 -
Below example describes about sending mail from HTML page.
<!DOCTYPE html>
<html>
<title> HTML Email Links Example</title>
<body>
<a href="mailto:contact@">Email Us here</a>
</body>
</html>
Output -
Example2 -
Below example describes about sending mail from HTML page with CC, BCC, subject and body.
<!DOCTYPE html>
<html>
<title>Email Example with CC,BCC,subject and body</title>
<body>
<a href="mailto:contact@tutorialscampus.com?
cc=support@tutorialscampus.com
&bcc=Support@&subject=Email%20subject&body=Email%20body">
Email Us here with CC, BCC, Subject and body</a>
</body>
</html>