I have a mailto link like that <a href="mailto:a&[email protected]" >
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.
Some email addresses that contain certain characters, such as the ampersand, may return as invalid recipients although the address is valid.
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.
subject=<subject> to the mailto tag. For example, the complete tag would look similar to the example below. You can also add body text by adding &body=body to the end of the tag, as shown in the example below. You can also include &cc= or &bcc= to fill out the CC and BCC fields.
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.
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#[email protected], 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.
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