Open default mail program, create new message with the TO field already filled out.
<a href="mailto:[email protected]">Email Us</a>
Adding a subject
Open default mail program, create new message with the TO and SUBJECT field already filled out. Essentially we are adding the parameter subject to the href value.
Spaces in the subject will probably work OK, but to be super-extra sure, you can replace spaces with “%20”.
<a href="mailto:[email protected]?subject=Mail from Our Site">Email Us</a>
Adding CC and BCC
Open default mail program, create new message with the TO, SUBJECT, CC, and BCC field already filled out. Essentially we are 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=Big%20News">Email Us</a>
Adding body text
Just add the body parameter into the ever-growing list of parameters we are using.
<a href="mailto:[email protected][email protected], [email protected], [email protected]&[email protected]&subject=Big%20News&body=Body-goes-here">Email Us</a>
The following is a demo of different email link usage. The links will not trigger in the embedded demo, but you can see them in action in the full page view.
Sadly, mailto’s are a call-for-spammers widely, so this is a curiosity more than something to use actually.
@JMLeon: Not if you use Hivelogic’s Enkoder:
I just used this today for a client, as a stop-gap till he can set up a contact form.
Although people have been steadfast in their belief that the sky would fall, the world would end, and that their email boxes would overflow with spam if they were crazy enough to use mailto, I have yet to see the problem materialize. I have a number of smallish sites that have been up for years using mailto without ever having a problem. I do use contact forms on larger sites but only because I think it looks more professional.
Excellent post Chris! Very handy stuff.
Yeah, I’ve had a public email address for more than a decade and mail servers and providers have gotten too good for spammers to get through. I never ever get a single spam message in my inbox. Not anymore. It is spam that is becoming a thing of the past really.
2022 and I still use mailto: I actually get way more spam with a contact form (even with honeypot). Thanks for this!
I think you can use also the Paragraphs in the body message. Syntax = %0A%0A
MailTo with multiline message in Body
a href=”mailto:[email protected]?body=The message’s first paragraph.%0A%0ASecond paragraph.%0A%0AThird Paragraph.”
@Kartlox Tchavelachvili Thanks for the paragraph syntax …
Thanks! Great timely tip… I needed the return chars =)
I really appreciate this! Thank you!
Caution: This may NOT work with all mail clients. I’ve had problems getting this to work with some mail clients in the past.
Thank you for the simple and effective approach for a contact option. Its nice.
Thanks for reminding me about something I learnt originally in the 90s!
You mean learned?
Learnt is fine
Learnt is ok in British English, but not in common use in the US.
Well, I’m glad you learnt it in the 90s. Some of us are still learning. What if you hadn’t and now wanted to? We’re not all computer junkies. This is what gets me. Because a computer tech or computer lover knows something they think everyone should already know or they are to be looked down on. Arrogance runs rampant in this field.
Style links depending on file format
/* external links */
background: url(external.gif) no-repeat center right;
Awesome. Hope they’re are still compliant. Thank you for this.
I am using this code in ipad app and it’s working perfectly but the problem is that all work is done out side the app means after mail, app is closed.
Can we attache any attachment with this. Please let me know.
The end user must have a default mail prgm set up to work in windows.
@premkumar: It doesn’t seem to work in Safari or Chrome (probably WebKit-based browsers, in general) if there are actual spaces in the querystring parameters to the
If you replace the spaces with
%20, then you should be back in business.
I want a source code, when a visitor wants to click on “Email Offer” then a pop up is open with option of email clients, like – outlook, gmail and yahoo. When he/she select email client then it opens with my email id, Subject and offer. Or he/she wants their default email client in future when they visit again, a check box is also display in pop up.
Is there any way to align the text in mailto body to the right ?
I am adding Arabic text in mailto body, Arabic text starts from right to left
ill be great full for any help and suggestion
Would I be able to use this code in Facebook, when writing on my wall?
I would like to use a mailto command in SharePoint for use internally (Outlook 2010). I understand how to do the to, subject and body text, but I’d like to be able to dictate the background used (from those available in Outlook) so that users have a choice. Any ideas?
I have a form that is a test, which asks for the name of a student who fills. I want to send an email warning that the test was completed and will include the student’s name. How do I include in HREF student’s name? Thank you
It’s still very nice so far. Thanks
my web is here
Could you put HTML into the body this way?
For example, bolding a word.
Is there any way to include a variable in the mailto code e.g the filename of the page it appears on? It could then be used to receive comments?
What I’d really like to do is to have the message sent as part of the mailto, so users don’t see a mail popup where they have to click send before it goes out. I know it’s astonishing to we geeks, but that really does confuse some people.
Can we have HTML content in the mail.
<a href=”mailto:[email protected]?subject=hello&body=< b >Make me Bold</ b >”
when i do this the output in the body is:
< b >Make me Bold< /b >
But i want the text to be bold. is this even possible ?
Looks like there is a space in your bold tag:
there is a question confused me that how can find the mailto body length limit when needs send custom reports like html table format.
Any way to CC yourself?
When client clicks email link,
they get to:
email me, —mailto:
receive cc copy to their own email — cc=(how do i do this?)
see subject, — subject=
begin body text, — body=
Depends, if you’re authenticating with the server you could set the email as a session variable and when you build the link insert it as a param.
Here’s a tool for building mailto links: https://email-link-builder.netlify.com/
Can add “reply-to” attribute in the mailto syntax, if not how can we make the recipient reply to another email address.
I want to implement this in html page.
Is there any possibility where we can post html code into mailto body template, so that users will aware where to enter comments, where to enter response (after specific label in email).
How can I insert an image in the body of the email and how to I link text to websites?
Hey! You’ll add an image like you normally would in the HTML:
…then linking text to a website is sort a the same deal:
<a href="your-link" rel="nofollow">Link Text</a>
Hope this helps!
Just wanted to ad a couple of thoughts;
read an interesting article on conversion rates of mailto vs on-line form and this article
seemed to suggest, on mobile especially, conversion is better using mailto.
Also something I particularly like is when you get a response from mailto you know the email address is correct. We have a bit of an issue with people giving incorrect emails on the form and I’m gonna switch to mailto to get rid of that.
What about the option of not specifying the email address and letting the user fill that?
You simply leave the email out,
mailto: – will open the email client
I’m working on an open source library to handle the mailto and tel links! It’s called mailgo https://mailgo.dev. The library substitute the classic behaviour that links with a modal with more possibilities for the users, maybe it can be useful for someone!
Can we send html with body like &body=
I have set it is not parsing inside gmail, only plain text are sending.
Hey Can we format the text in the body. Is it possible ?
Excellent. Just used this on our site – with both subject and body section populated. Should help with conversions!
is there a code for call a number similar like this ?
I want to add this code toa button in elementor
Hey Neo, there sure is! Telephone links are a lot like email links, but prepend the phone number with
Here’s a deeper post on how telephone links work.
wanted to understand how the Mailto works?
I copied the link that you showed and it did not work for me
Is there a specific one that isn’t working? Just added a demo at the end so you can click the examples to see how they work.
Should a title property be set on mailto links? I’ve never assigned one in the past but we are getting challenged on this following the introduction of accessibility legislation. We include the title property in all other links.
Thanks, is it possible to create links inside the body of mailto href?
the demo doesn’t work…
Hey there! CodePen blocks the action, so you’ll need to use the demo in another window over here.