Questions tagged [mailto]

Mailto is the URI scheme for email addresses. It is used in web pages as a link that opens a new email message to the specified to-address in the user's default email client.

Mailto is the URI scheme that targets the user's client from within the browser. Clicking a mailto link creates a new email message in the user's email client, optionally with to, cc, subject, and body pre-populated.

A mailto link can be inserted into a webpage using a standard link:

  • The simplest mailto link specifying a recipient addresses..

    <a href='mailto:someone@host.com'>Click to email</a>
    
  • Multiple recipients..

    <a href='mailto:nobody@host.com,nowhere@host.com'>Click to email</a>
    
  • Autofill the subject line..

    <a href='mailto:someone@host.com?subject=This%20is%20the%20subject'>Click to email</a>
    
  • Autofill the subject line and specify the email to be CC'd to..

    <a href='mailto:someone@host.com?cc=me@me.com&subject=Testing%20mailto&'>Click to email</a>
    
  • Mailto 3 people, with a BCC and a subject..

    <a href='mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com&bcc=lastperson@theirsite.com&subject=Big%20News'>Click to email</a>
    
  • Autofill the subject line and body of the email with a linebreak..

    <a href='mailto:someone@host.com?subject=Readme&body=This%20is%20the%20first%20line%0D%0AThis%20is%20the%20second'>Click to email</a>
    
  • Add a reply-to address..

    <a href='mailto:someone@host.com?reply-to=me@me.com'>Click to email</a>
    

Special Character escaping

Within mailto URLs, the characters "?", "=", "&" are reserved.

Special characters that appear in addresses, headers or message contents must be encoded using a "%" followed by a two-digit hex number. See RFC3986 for a exhaustive description of URL encodings.

Space = %20             : = %3A         ] = %5D
Line Break = %0D%0A     ; = %3B         { = %7B
" = %22                 ' = %27         } = %7D
# = %23                 < = %3C         \ = %5C
$ = %24                 > = %3E         | = %7C
% = %25                 / = %2F         = = %3D
^ = %5E                 ? = %3F
& = &amp;               [ = %5B

8-bit characters in mailto URLs are forbidden.

More information

  • RFC 2368, which defines the mailto scheme.
1116 questions
43
votes
2 answers

Register Windows program with the mailto protocol programmatically

How do I make it so mailto: links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for…
Liron Yahdav
  • 10,152
  • 8
  • 68
  • 104
43
votes
3 answers

Mailto: Body formatting

Possible Duplicate: mailto link multiple body lines Just a quick question. I am creating a website for a charity and they have a section on the site where people can give some suggestions for how they could raise more money for their cause. Their…
legendary_rob
  • 12,792
  • 11
  • 56
  • 102
40
votes
9 answers

Open the href mailto link in new tab / window

I have an image which when click, I want to link to a mailto: email However, currently once its clicked,…
shennyL
  • 2,764
  • 11
  • 41
  • 65
40
votes
8 answers

Use

I'm creating a custom button on my webpage which actually is a
, I want to trigger a mailto when the button is clicked. What is the best way out? I've tried calling a javascript function using-onClick that looks like this - function foo(){ …
divyanshm
  • 6,600
  • 7
  • 43
  • 72
39
votes
3 answers

Webview email link (mailto)

I have a view and view the site has malito code to send email. When I open the link opens in an error. I want that when I open the link opens Gmail app or another email application. Thanks to all helpers. public class teacher extends Activity…
omer341
  • 467
  • 2
  • 8
  • 12
35
votes
6 answers

Mailto on submit button

Is it possible to implement mailto: function on submit button like ? I use ASP.NET MVC. Maybe there is some tricky controller action result to achieve this. Could you please help me? P.S. I know that I can make anchor looks…
Pavel Shchegolevatykh
  • 2,568
  • 5
  • 29
  • 32
35
votes
3 answers

How to open mailto links in new tab for users that have gmail as the default mail handler?

On a web page mailto links open the default e-mail client. Now that Chrome offers the ability to set Gmail as the default e-mail client, some users have the links open in the same window thus taking them away from the page they clicked the link…
Martin Henk
  • 351
  • 1
  • 3
  • 3
34
votes
8 answers

How to prevent mailto event from opening a new tab in browser

I am using a mailto: filled in JavaScript to send information throughout my web application, but everytime a user presses the Send button, it opens a new tab in the browser before opening the mailing application (Outlook, Gmail, etc). Is there any…
Jeff Noel
  • 7,500
  • 4
  • 40
  • 66
31
votes
4 answers

C# MailTo with Attachment?

Currently I am using the below method to open the users outlook email account and populate an email with the relevant content for sending: public void SendSupportEmail(string emailAddress, string subject, string body) { Process.Start("mailto:" +…
Goober
  • 13,146
  • 50
  • 126
  • 195
30
votes
4 answers

Mailto with multiple cc addresses

I would like to know how to include multiple email addresses in mailto link. I am trying this: Contact Email But it is not working. Any idea…
pollux1er
  • 5,372
  • 5
  • 37
  • 36
30
votes
1 answer

Getting all mailto links with jQuery

I need a pattern that will traverse the document and get me all links that have mailto in their href: text I could of course easily get all a elements ($("a")) and check each href attribute to see if it points to a…
Andreas Grech
  • 105,982
  • 98
  • 297
  • 360
29
votes
4 answers

Replacement for javascript escape?

I know that the escape function has been deprecated and that you should use encodeURI or encodeURIComponent instead. However, the encodeUri and encodeUriComponent doesn't do the same thing as escape. I want to create a mailto link in javascript with…
gusjap
  • 2,397
  • 5
  • 24
  • 38
27
votes
5 answers

React open mailto E-Mail client onClick with body from textarea

This sounds like it must have been asked before but I could only find how to do this in react native but I could not find how it's done in normal react for web. Preferably not with an a tag or Link tag that needs to be styled. Here some code to…
CodingYourLife
  • 7,172
  • 5
  • 55
  • 69
27
votes
7 answers

mailto link not working within a frame chrome (over https)

I have a mailto link on a page. It works as expected when the page is loaded by itself. However when the page is loaded via a frameset in Chrome nothing happens. With the developer tools loaded the error "[blocked] The page at https://mysite.com ran…
Dale K
  • 25,246
  • 15
  • 42
  • 71
1
2
3
74 75