Issue with mailto link in email address containing

2019-02-21 13:36发布

I have a mailto link like that <a href="mailto:a&b_admin@xyz.com" > it displays correctly on html but when we click on the link the outlook just shows a in the to address. Has anyone faced the same problem please suggest.

标签: html mailto
1条回答
趁早两清
2楼-- · 2019-02-21 13:46

Percent encoding the string is required for IE and I assume will work across browsers. From this MSDN document:

Windows Internet Explorer 7 and later. You must percent-encode all URL-reserved characters within a mailto: address. For example, the number sign (#) is used as a fragment identifier in URLs. When processing an address such as some#one@example.com, Internet Explorer copies only the portion up to the number sign into the mail client; the fragment portion including the number sign is ignored. This behavior is by design.

So you need

 <a href="mailto:a%26b_admin%40xyz.com">

As said, I expect a percent encoded address will work in all browsers, but I don't know for sure. I can confirm it works with Chrome and Thunderbird.

查看更多
登录 后发表回答