Link to home
Start Free TrialLog in
Avatar of meeker
meeker

asked on

How to use mailto with an ampersand in the email address

Hi

I am wanting to use MAILTO to send an email from a web page, however in some instances the email address has an ampersand character in it (eg joe&shmo@flow.com) - can anyone suggest how I can do this?

I have tried using &, & and %26, but when the user clicks on the mailto link, the email client (normally outlook 2000) will only display the bit of the email address prior to the character (eg "joe").

Thanks!
Avatar of webwoman
webwoman

I've not seen e-mail addresses with ampersands... but the bigger question is mailto. All it does is open an e-mail window if the browser is configured with one.

If you're trying to submit a form, it's much, much, much better to do it server side.

But you're still going to have a problme with an ampersand in the address...
I don't think you will be able to do that, but if there is a way to do it, the answer might be here:

http://developer.netscape.com:80/viewsource/husted_mailto/mailto.html 

Cd&
ASKER CERTIFIED SOLUTION
Avatar of nfroio
nfroio
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm using Outlook 2K (v. 9) & it won't work for me with either & or &.

http://crsemail.sourceforge.net/docs/rfc822.txt 
see 6.1

Shouldnt use an ampersand in your email address...
Avatar of meeker

ASKER

Thanks for the comments so far...

WebWoman: Thanks - we're not submitting forms though, just providing the opportunity for people to click on a link and send an email.

Malcx: Unfortunately the organisation already has a good number of email addresses with an "&" in the email address - this is allowed and works perfectly fine in every other case - indeed RFC2368 details that the & character should work fine with mailto as long as the & character is encoded (i.e. as %26) although admittedly it is dependent on the email client to correctly interpret the URL.

Thanks to nfroio - your comment has helped me identify that this appears to be a bug in Outlook 2k - although I can't find anything about it on MSDN.

I will leave this question open for another 24 hours just in case other comments help resolve the situation, if not, then nfroio will get the points.

Thanks!

why not writing w3c conform tags like:
  <A HREF="Mailto:joe%26shmoo@flow.com">SendMail</A>
Avatar of meeker

ASKER

Thanks for the suggestion, ahoffmann, I had already tried that - doesn't work with outlook 2k - just gives "joe" in the email address.
Thanks meeker, can you downgrade back to Outlook 5?? But of course, that's not really gonna help the outside folks who are using Outlook 2K.. hmmmmmm

The reason is that with O2K you can build a link like this:
mailto:me@mycompany.com&subject=Test%20Subject&body=Test%20Body%3F

Check the link below for the possible punctuation characters.  The & is not listed.

Reference:
http://support.microsoft.com/default.aspx?scid=%2fsearch%2fviewDoc.aspx%3fdocID%3dKC.Q197782%26dialogID%3d4188697%26iterationID%3d1%26sessionID%3danonymous%7c3721394


dill
Would referencing the symbol in hex notation work?

   &#x26;

   <a href="joe&#x26;shmo@flow.com">email</a>
sorry I left out the mailto in the first example

Would referencing the symbol in hex notation work?

  &#x26;

  <a href="mailto:joe&#x26;shmo@flow.com">email</a>
gotaluvme,

Nope, no dice.

dill
Avatar of meeker

ASKER

Thanks for your help guys!

Matt
Thanks Matt, my first HTML TA Points... weeeeee!!!
nfroio