“mailto” script bug with multiple email addresses (on PC)

14 05 2009


If you are here only to see the bug and solution, please skip the following paragraphs in italic and go straighahead to the content below line “+++++++++++++++++++++++++++++++++++++++++++”.

It is pretty common to include an “email us” button on a page. The behavior of most of  “email us” buttons is that when user clicks on the button, their default email client will popup a new window to compose a new email, probably with pre-populated “to” field, “subject” field, etc. Pretty standard stuff.

The simple code that needs to be attached to the button looks something like this:

[1] <a href=”mailto:johnDoe@example.com?subject=Hi”>email John Doe</a>

If you need to include the alias of the email address, use carrots before and after the actual email address. Something like this:

[2] <a href=”mailto:John Doe<johnDoe@example.com>?subject=Hi”>email John Doe</a>

If you need to include 2 email addresses in the “to” field, use comma to separate the addresses, like this:

[3] <a href=”mailto:johnDoe@example.com, maryDoe@example.com?subject=Hi”>email John and Mary</a>

So it is natural to think that you can combine the 2 techniques above to include 2 email addresses with their aliases like this:

[4] <a href=”mailto:John Doe<johnDoe@example.com>,Mary Doe <maryDoe@example.com> ?subject=Hi”>email John and Mary Doe</a>

Ha.  There. You are about to run into a problem that I did yesterday.


The bug is when you include multiple email addresses with their aliases in the “to” field. If you use the code as the above line [4] in red, you are gonna only get the first email address (John Doe’s) prepopulated in the “to” field of your Outlook window, if you are on one of the following browser/OS combinations:

[+] IE6 on Windows XP
[+] Firefox 2 on Windows XP
[+] IE7 on Windows Vista
[+] Firefox 3 on Windows Vista

I have tried to replace the spaces with “%20” and the carrots with “&lt;” and “&gt;”, “%3E” and “%3C”, tried to replace “,” by “;”, but found little help. Below are the “solutions” I have come up so far… Obviously I am not happy with any of them.

[Solution A]:
Get rid of Mary’s email completely from the script. Set up the mail server so that all emails John received will be forwarded to Mary by the server automatically.

[Solution B]:
Get rid of both the aliases and the carrots, so the script looks like line [3] in green above.

[Solution C]:
Tell your users that it is time for them to get a MAC.  🙂

Please let me know if you have other solutions in the comments. Will be much appreciated.




One response

29 10 2009

Do you have any experience getting this to work in Flash Builder 4 beta 2?

I am excited to work with the new RichText and TextFlow features. Any leads would be appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: