Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "MailTo" ...setting a proper name on the Recipient

Tags:

html

How do I set a proper name for the recipient when in HTML I want to use the "mailto" tag.

Something like:

mailto:"John Wayne([email protected])?subject.. 

How do I achieve that ??

like image 677
SF Developer Avatar asked Nov 16 '11 06:11

SF Developer


People also ask

What is mailto in email address?

A mailto link is clickable text that automatically opens a new email in the reader's default email client, such as Outlook or Gmail, and pre-fills the "To" email address. Mailto links are great when you want emails on certain topics to go to a designated email account or employee.

Why is my mailto link not working?

If mailto links don't open for you the way they should, a quick look at the system or browser settings should do the job. In Windows, head to Settings -> Apps -> Default apps. Scroll down and pick “Choose default apps by protocol” from the menu. For 'Mailto', choose the client of your choice.


2 Answers

The original standard for mailto: links, RFC 1738, says this:

A mailto URL takes the form:

mailto:<rfc822-addr-spec> 

where <rfc822-addr-spec> is (the encoding of an) addr-spec, as specified in RFC 822 [6].

Under that definition, no proper name could be included.

But the mailto: section of RFC 1738 has been superseded by RFC 2368, which allows (among other things, including predefined subject lines) for an RFC 822 mailbox specification—which includes a proper name.

[2016-05-31] As David Balažic points out in a comment, RFC 2368 is in turn obsoleted by RFC 6068. From Section 9, “Main Changes from RFC 2368”:

The main changes from RFC 2368 are as follows:

  • Changed syntax from RFC 2822 <mailbox> to [RFC5322] <addr-spec>.

In actual use, mailto:Fred Foo<[email protected]> still seems to work, but it’s not officially supported; you may also have to encode the space, i.e., mailto:Fred%20Foo<[email protected]>, and/or put the name in quotes, i.e., mailto:"Fred Foo"<[email protected]>.

like image 103
J. C. Salomon Avatar answered Oct 08 '22 19:10

J. C. Salomon


Try this: mailto:%22John%20Wayne%22%[email protected]%3e?subject..

Wrap the name in %22 and the email has %3c before it and %3e after it and %20 for spaces

That will output: "John Wayne"<[email protected]>

Full list of URL Encoding here: http://www.w3schools.com/tags/ref_urlencode.asp

like image 33
Jason Ellis Avatar answered Oct 08 '22 18:10

Jason Ellis