The “MailTo” …setting a proper name on the Recipient

匿名 (未验证) 提交于 2019-12-03 03:04:01

问题:

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(jw@email.com)?subject.. 

How do I achieve that ??

回答1:

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

RFC 6068. From Section 9, “Main Changes from RFC 2368”:

The main changes from RFC 2368 are as follows:

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



回答2:

This will work: mailto:%22John%20Wayne%22%3cjw@email.com%3e?subject..

You have to 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"<jw@email.com>

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



回答3:

I tried

mailto:John Wayne<jw@email.com>?subject... 

and it seems to work.



回答4:

  <a href="mailto:lala lala2(astark1@unl.edu)?subject=MailTo Comments&cc=ASTARK1@UNL.EDU&bcc=id@internet.node">ddddd</a> 

Remember to use only one ? (question mark), when providing multiple entries beyond e-mail address



回答5:

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%3cjw@email.com%3e is valid.



回答6:

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.



回答7:

Encode the uri and assign it to mailto.

Also your email and display name need to be formed as either John Wayne <jw@email.com> or jw@email.com (John Wayne).

Make sure you did encodeURI for these. Else it wont work properly in different mailclients.



回答8:

You can't set the receipt name on mailto links



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!