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 ??
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.
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.
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]>
.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With