Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    Send Mail Using HTML Email Link

    Creating HTML email links is an effective way for users to quickly send emails directly from a webpage. In this tutorial, you will learn how to send emails using HTML email links.

    Understanding HTML Mailto Links

    HTML email links, or mailto links, allow users to effortlessly initiate email conversations by clicking a hyperlink directly from your web pages. When clicked, the link triggers the user's default email client to open a new message window with pre-populating fields like 'To', 'CC', 'BCC', and 'Subject'. This feature is handy for contact pages, support links, or direct communication prompts.

    Basic Mailto Link Structure

    The simplest form of a mailto link opens the user's email client with a specified recipient. Here is an example:

    <a href="mailto:[email protected]">Send Email</a>
    

    Adding CC and BCC Recipients

    To include CC (Carbon Copy) and BCC (Blind Carbon Copy) recipients, add them as parameters in the link:

    <a href="mailto:[email protected][email protected]&[email protected]">Send Email</a>
    

    Prefilling the Subject Line

    Prefilling the subject line can provide context to the email. Add a 'subject' parameter like this:

    <a href="mailto:[email protected]?subject=Meeting Request">Send Email</a>
    

    Sending to Multiple Recipients

    To send an email to multiple recipients, separate the email addresses with commas:

    <a href="mailto:[email protected],[email protected]">Send Group Email</a>
    

    Prefilling the Email Body

    You can also prefill the body of the email. Use %20 for spaces and %0A for line breaks:

    <a href="mailto:[email protected]?body=Dear%20Team,%0AI%20would%20like%20to%20discuss%20the%20upcoming%20project.%0AThank%20you.">Send Email with Predefined Body</a>
    

    Combining Multiple Parameters

    For a more advanced link, combine several parameters using &:

    <a href="mailto:[email protected][email protected]&[email protected]&subject=Meeting Request&body=Dear%20Team,%0AI%20would%20like%20to%20discuss%20the%20upcoming%20project.%0AThank%20you.">Send Comprehensive Email</a>
    

    Best Practices and Limitations

    • Length Limitations: Be mindful of character limits in mailto links, which typically handle up to 2000 characters.
    • Encoding Special Characters: Use URL encoding for special characters in the subject and body to ensure proper display.
    • User Experience: Not all users have a default email client set up. Consider this when designing your user interface.
    • Security and Privacy: Avoid using sensitive information in mailto links, as these can be easily read in the page's source code.

    Conclusion

    By following these steps, you can effectively integrate email functionality into your web pages, providing a convenient way for users to initiate email communication directly from your site.



    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.