WordPress / Web Development Tutorials
(Best WordPress Tutorials)

CSSHTMLJavaScriptjQueryMySQLPHPSilvaTechnologiesWooCommerceWordpress
Silva Web Designs - Blog

How to Add Mailto Links / Including a Subject, CC, BCC and Body Text

The Standard Way

This will open your default mail program and will create a new message with the ‘TO’ field already filled out.


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

Adding a Subject

This will open your default mail program and will create a new message with the ‘TO’ and ‘SUBJECT’ field pre-populated. We’re essentially adding the parameter subject to the href value.

Spaces in the subject will probably work just fine, but a better way to add spaces is to replace them with "%20".


<a href="mailto:[email protected]?subject=Awesome, the subject is pre-populated">Email Us</a>  
<!-- or -->
<a href="mailto:[email protected]?subject=Awesome,%20the%20subject%20is%20pre-populated">Email Us</a> 

Adding CC and BCC

This will open your default mail program and create a new message with the ‘TO’, ‘SUBJECT’, ‘CC’, and ‘BCC’ field already filled out. We’re essentially adding the parameters cc and bcc to the href value.

Also, note that you add multiple values to CC and BCC by comma separating them πŸ˜‰


<a href="mailto:[email protected][email protected], [email protected], [email protected]&[email protected]&subject=Woohoo,%20We're%20nailing%20it!">Email Us</a>  

Adding Body Text

For this one, just add the body parameter into the super long mailto we’ve been creating!


<a href="mailto:[email protected][email protected], [email protected], [email protected]&[email protected]&subject=Woohoo,%20We're%20nailing%20it!&body=Now%20we've%20got%20body%20text,%20pretty%20sweet%20huh?">Email Us</a>  

If you’ve reached this point, you’re now a superhero in adding mailto links!

 

Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital-related. His main expertise is with WordPress and various other CMS frameworks. If you need responsive design, SEO, speed optimisation or anything else in the world of digital, you can contact Silva Web Designs here; [email protected]

It’s good to share

One thought on “How to Add Mailto Links / Including a Subject, CC, BCC and Body Text

  1. I am looking for an help that make this html coding working also for mobiles.
    I have this working well from desktop, but when clicked from mobiles the pre filled fields are bank!!!

Join the discussion