views:

250

answers:

3

I am having a problem using Internet Explorer 8 (IE8) to open mailto links with long messages.

After the user clicks on the link, IE changes to an about:blank page and never completes the call to outlook to create an email

Here's an example:

<a href="mailto:[email protected]?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111">mailto fails in IE8</a>

If I shorten the list of 1's, the email is generated and can be sent.

Is this a known IE issue? What are the limitations?

A: 

it appears that the following hyperlink seems to work. It is 512 characters long and seems to work every time. You can increase the length of the To, but you must subtract either from subject or body. Same with subject.

I wish this was documented somewhere; I am just guessing from experimenting with this.

<a href="mailto:[email protected]?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111234">

I will gladly accept any answer from a person that can track down documentation that indicates that this is a known issue.

MedicineMan
512 is a rather odd number. 2038 is the longest legth that IE supports for URLs, but 512 makes that really weird
Earlz
A: 

My advice would be to stop abusing the poor mailto link. If you want to prepopulate that much information, build a contact form for the user.

micmcg
A: 

I too ran into this problem with IE8. Amazing that this is happening; it seems like a problem we'd have run into circa 1998!

Anyway, I did some testing and came up with a workaround that uses Javascript:

<a href="javascript:doMailto()">Send Email</a>

Then define this script:

<script type="text/javascript">
   var sMailto = "mailto:[email protected]?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111234567890";

   function doMailto() {
      document.location.href = sMailto;
   }

</script>

For whatever reason, IE has no problem "forwarding" to long URLs (my testing scenario uses 800+ characters). In cases with multiple mailto links, you could define multiple URL variables and send a parameter into doMailto() that lets it switch to the appropriate one.

Is it ugly? You bet. But it works in a pinch.

CBono
FWIW, I consistently had problems with URLs longer than ~505 characters. So even 512 doesn't seem like a hard-and-fast rule. Thanks, IE8!
CBono