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 ??
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 ??
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, addr-spec is of the form "local-part@domain", so no proper name could be included.
But the mailto:
section of RFC 1738 was first 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:
An RFC 5322 <addr-spec>
is of the same "local-part@domain" form as mentioned above, so once again, no name can officially be included.
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]>
.
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
mailto:John Wayne<[email protected]>
(with or without encoding the space between first and last names) does work.
Reply-To
header field.
As mentioned in other answers, RFC 2368 allows the full mailbox
syntax, which can be in name-addr
(display-name
plus angle-addr
) form (RFC 5322). Unfortunately, it was obsoleted by RFC 6068, which only allows addr-spec
form. However, both specifications allow omitting the URI authority (where the to-address usually goes) and specifying full header fields (including To:
) as query parameters. Therefore, mailto:?to=John%20Wayne%20%[email protected]%3e
is valid.
mailto:?to=John%20Wayne%20%[email protected]%3e
does work with ubuntu+evince+thunderbird, but it does not work with windows7+firefox+outlook. However mailto:John%20Wayne%20%[email protected]%3e
works with both.
Jan 16, 2018 at 10:30
<a href="mailto:lala lala2([email protected])?subject=MailTo Comments&[email protected]&[email protected]">ddddd</a>
Remember to use only one ? (question mark), when providing multiple entries beyond e-mail address
This all depends on what mail client you use. I've tried that long before at Outlook express and it's ok. But after many years, I use Dream Mail and it will only bring in the mail address part while leave out the name part.
Encode the uri and assign it to mailto.
Also your email and display name need to be formed as either John Wayne <[email protected]> or [email protected] (John Wayne)
.
Make sure you did encodeURI for these. Else it wont work properly in different mailclients.
You can't set the receipt name on mailto links