1

When a user clicks on the "send email" button, their default email application opens with the subject line: Request Information".

Can anyone tell me why this "mailto:" code will not work in IE7/8? It works correctly in FF, Chrome and Safari. I don't want to have to wrap up my image in an anchor tag, unless there's no other way.

HTML

<a href="mailto:info@mydomain.com?subject=Request Information" class="info-main">Send email</a>

CSS

.info-main {
background-image:url('/i/info_email_button.png') no-repeat;
display:block;
    height:123px;
    width:24px;
text-indent:-9999px;

}

Thanks!

Chris22
  • 1,973
  • 8
  • 37
  • 55

3 Answers3

3

You should URL-encode your subject line. In this case, replace the space with either + or %20.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • Thanks, I tried both. It does not launch the app. As a matter of fact, when I click on the image, it totally freezes IE and in the status bar it displays the entire "mailto" code string. I removed the subject property as well, but still it still doesn't work. The cursor changes to the hand pointer, but nothing happens. – Chris22 Jan 26 '12 at 18:51
  • Need to get a new copy of IE for my laptop. It works on other machines. – Chris22 Jan 30 '12 at 18:42
2

I ran into this problem with mailto: email links not working in IE9 and FirefoxF22 on PC and fixed it when changing the element to regular ole div. So instead of:

    <button class="foo-btn"><a href="mailto:foo@bar.com">E-mail</a></button>

Try this for IE9:

    <div class="foo-btn"><a href="mailto:foo@bar.com">E-mail</a></div>

The other solutions I saw about adding ...target="_blank" or it being a Google Analytics script conflict didn't solve the issue for me.

2

Use Url-Encode for spaces and special characters, that means:

<a href="mailto:info@mydomain.com?subject=Request%20Information" class="info-main">Send email</a>
Gregor
  • 4,306
  • 1
  • 22
  • 37
  • I tried using the Url-Encode (above) but it's not working. Clicking the image freezes IE and then it crashes. I have to go to task manager to end the task because it takes so long to close IE – Chris22 Jan 26 '12 at 18:53
  • 1
    I hate IE. I can't believe I have to add img markup in my html just to pacify that whack browser, man – Chris22 Jan 26 '12 at 18:58
  • Says the person who thinks it's acceptable/reasonable to indent text by negative a bazillion pixels... – Niet the Dark Absol Jan 26 '12 at 19:19