You need to create a link that automatically opens a new email in Outlook with the recipient, subject, and message already filled in. This is done using a special type of web link called a mailto link. This article explains the correct HTML syntax to build these links and how to use them in documents and web pages.
Key Takeaways: Mailto Link Syntax and Parameters
- mailto:recipient@domain.com: The basic link structure that opens a new email addressed to the specified recipient.
- ?subject=Your Subject: The parameter that pre-fills the email subject line. Use %20 for spaces.
- &body=Your message text: The parameter that pre-fills the email body. Use %0D%0A for line breaks.
Understanding Mailto Link Structure and Parameters
A mailto link is a Uniform Resource Identifier scheme. When a user clicks it, their default email client launches a new message window. Outlook must be set as the default mail app in Windows for the link to work correctly. The link can include several parameters to pre-populate fields like the recipient, carbon copy, subject, and body text.
The parameters are added to the base email address using a question mark to start the query string. Different parameters are separated by an ampersand. Special characters and spaces must be encoded. For example, a space becomes %20 and a line break is represented by %0D%0A. This encoding ensures the link is interpreted correctly by the browser and Outlook.
Common Mailto Parameters
Beyond the basic recipient, you can use several standard parameters. The ‘cc’ parameter adds carbon copy recipients. The ‘bcc’ parameter adds blind carbon copy recipients. The ‘subject’ parameter defines the email’s subject line. The ‘body’ parameter contains the main message text. You can combine all these in one link to create a fully pre-filled email draft.
Steps to Build a Mailto Link for Outlook
Construct the link by starting with the mailto: scheme followed by an email address. Then add parameters to set the subject and body. The following steps show the exact syntax.
- Start with the basic recipient link
Begin your HTML anchor tag with the href attribute. The value must start with mailto: followed by the intended email address. For example: <a href=”mailto:someone@example.com”>Email Us</a>. - Add the subject parameter
After the email address, add a question mark and the subject parameter. Use the format ?subject=Your%20Subject. Replace spaces with %20. Example: <a href=”mailto:someone@example.com?subject=Meeting%20Request”>Request a Meeting</a>. - Add the body parameter
To include body text, use an ampersand after the subject parameter, then &body=Your%20message. Use %0D%0A to create line breaks within the body. Example: <a href=”mailto:someone@example.com?subject=Agenda&body=Please%20review%20the%20attached%20agenda.%0D%0A%0D%0ABest%20regards,”>Send Agenda</a>. - Add multiple recipients or CC/BCC
Separate multiple email addresses in the main ‘to’ field with commas. Use &cc=email@cc.com or &bcc=email@bcc.com to add copy recipients. Example: <a href=”mailto:primary@example.com,secondary@example.com?cc=manager@example.com&subject=Team%20Update”>Email Team</a>. - Test the link in a web browser
Save your HTML file and open it in a web browser like Microsoft Edge. Click the link you created. It should open a new message window in Outlook with all the specified fields filled in.
Common Mistakes and Limitations to Avoid
Mailto link does nothing when clicked
This usually means no default email app is set in Windows. To fix this, open Windows Settings, go to Apps > Default apps. In the search bar, type “mail”. Click on the result and select Outlook for Windows or the classic Outlook desktop app as the default.
Special characters appear broken in the subject or body
You must use URL encoding for special characters. Ampersands, question marks, and equals signs break the link structure if not encoded. Use %26 for &, %3F for ?, and %3D for =. Always encode spaces as %20.
Line breaks are not working in the body text
You must use the correct carriage return and line feed codes. In a mailto link, a new line is represented by %0D%0A. Using \n or just pressing Enter in your HTML code will not work. For multiple blank lines, chain the codes like %0D%0A%0D%0A.
The link is too long and gets cut off
Mailto links have a practical length limit, often around 2000 characters, depending on the browser. For very long body text, consider directing users to a web form instead. You can also use the body to provide a template with key fields for the user to fill in.
Mailto Link vs. Outlook COM Add-in: Key Differences
| Item | Mailto Link | Outlook COM Add-in / VBA |
|---|---|---|
| Primary Use | Web pages, HTML documents, PDFs | Automation within the Outlook desktop app itself |
| Complexity | Simple HTML syntax, no programming needed | Requires Visual Basic for Applications knowledge |
| Recipient Control | Opens in user’s default mail app, which may not be Outlook | Guaranteed to work within the Outlook instance it’s run from |
| Functionality | Limited to pre-filling basic fields (to, subject, body, cc, bcc) | Can attach files, use specific email templates, and interact with other Office apps |
| Deployment | Embed directly into any HTML-supported medium | Requires macro security adjustments and distribution of the VBA project or add-in file |
You can now create functional mailto links that launch Outlook with pre-filled emails. Use these links on intranet pages or in shared documents to standardize communication requests. For more advanced automation, explore creating an Outlook Quick Step that inserts standard text with a single click.