How to Use the Mailto Syntax - Examples

The mailto protocol lets you create hyperlinks that will directly launch the default email software and compose a new email message. Mailto commands in Firefox and Chrome even work with web mail programs like Gmail.

You probably know how to use the mailto command for quickly linking to one email address but the mailto syntax actually allows a lot more - you can address the same message to multiple addresses, populate the cc, bcc or subject fields, and even write text inside the email body.

Remember to use %20 for the space character and %0A to add a line break in the body text. You can also test any mailto command by directly typing the command in your browser’s address bar.

Master the mailto Syntax

Let’s assume you maintain the official Whitehouse website and need to create mailto links that will make it easy for visitors to reach the president via email.

1. Send an email to Barack Obama (single recipient)

<a href="mailto:obama@whitehouse.gov"></a>

2. Send an email to Barack and Michelle Obama (separate multiple recipients with a comma)

<a href="mailto:obama@whitehouse.gov,michelle@whitehouse.gov"></a>

3. Send an email to Barack but put Michelle in the CC: list and Joe Biden in the BCC: list

<a href="mailto:obama@whitehouse.gov?cc=michelle@whitehouse.gov&bcc=joe@whitehouse.gov"></a>

4. Send an email to Barack Obama with the subject “Congrats Obama”

<a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama"></a>

5. Send an email to Barack Obama with the subject “Congrats Obama” and some text in the body of the email message

<a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama&body=Enjoy%20your%20stay%0ARegards%20"></a>

You may use any permutations and combinations while writing a mailto hyperlink but make sure that there’s only one ? character.

Amit Agarwal is a web geek, solo entrepreneur and loves making things on the Internet. Google recently awarded him the Google Developer Expert and Google Cloud Champion title for his work on Google Workspace and Google Apps Script.

Awards & Recognition

Google Developer Expert

Google Developer Expert

Google awarded us the Developer Expert title recogizing our work in Workspace

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional title for 5 years in a row

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator award for technical expertise

Want to stay up to date?
Sign up for our email newsletter.

We will never send any spam emails. Promise 🫶🏻