Email links
You can create links on webpages not just to other webpages and resources, but to an email message as well.
This lesson focuses on:
- Creating a basic email link
- A more complex email link
Creating a basic email link
To create a basic email link the <a> tag is used just as it is used for regular links but instead of the href attribute taking the value of a URL, it takes the value of mailto: followed by the email address that the message will be sent to.
Example:
<a href="mailto:admin@landofcode.com">Contact us!</a>
Output:
Click on the above link and it will open a new email message in your email program with the "to" field already filled in.
A more complex email link
You can create even more complex email links that fill in the subject as well as the body of the email, not just the email address that the message will be sent to.
Example:
<a href="mailto:admin@landofcode.com?subject=Hey&body=Hello, cool website!">Contact us!</a>
Output:
Click on the above link and it will open a new email message in your email program with the "to" field already filled in as well as the subject field filled in with the value "Hey" and the body of the email filled in with the value "Hello, cool website!"




