In this blog post, we will see how we can create mailto links in HTML with ease.
MailTo links are anchor elements or links which open the default mail program and users can start creating the email subject and body using the default program.
MailTo links increase the overall user experience and increase the chance that the user will make a contact with the website.
MailTo also is helpful when you don't have a proper contact form in place which might need a mail server, which usually is a paid facility), MailTo takes around 5-10 minutes to set up and is free because it's using the user's default mail program.
Basic Usage Of MailTo Links HTML
Let's see a basic usage of mailto in an anchor element.
Adding Subject To MailTo Links HTML
Another variation to the mailto links is that along with filling the to address, we can also add the subject line to the new email from this mail link.
Let's see an example:
Adding CC and BCC To MailTo Links HTML
In this variation of the mailto links, we will add cc and bcc email addresses to the composed email.
In the below example, we see that we have filled four fields, to email address, subject, CC, and BCC fields.
Adding Body To MailTo Links HTML
We can add body text to the email as well using the body tag.