Search code examples
htmlhtml-emailmailto

Add subject line in HTML


I'm trying to add a hyperlink using HTML. When a sender clicks a link, I would like the browser to create a new email with a filled out To field and subject line.

Code

HTML

<html>
  <head></head>
  <body>
    <p>Thank you.<br>
    <a href="mailto:aaa@company.com">test</a> 
    </p>
  </body>
</html>

Solution

  • You need to do the following:

    <a href="mailto:aaa@company.com?subject=Testing out mailto!">test</a>
    

    If you would like to add a BCC and CC, you can add the following:

    <a href="mailto:aaa@company.com?subject=Testing email&bcc=bcc_email@gmail.com&cc=cc_email@gmail.com">test</a>
    

    See more details on this method here.