0

I can't figure out why I can't use a <a> tag around an <img> tag to make an image button in an HTML email work show up properly inside the iPhone's email client.

I the iPhone's Mail.app, when the user taps on the image, the iPhone let's the user save the download image (from the <img> tag) in stead of opening the link of the <a> tag.

The HTML code in the multipart email looks like this:

<p>Download the beta version of Clue here:<br>
<a href="http://mandrillapp.com/track/click.php?u=15131679&id=2a00d47e46b0457fb24993692ada811c&url=https%3A%2F%2Fclue-backend.herokuapp.com%2Fclue%3Femail%3Ddaniel%252Btest%2540helloclue.com%26token%3Dn568g7swalmm3fi&url_id=0c311a87c47c051a01b2bfb680b20c1918fa0965&tags=_all,_sendida@helloclue.com"><img src="cid:aunvkjyxsm" class="download"></a></p>

Off thing is that the link works just fine on a desktop email client, but not on the iPhone, even though other people's emails with similar HTML seems to work just fine.

Full multipart raw email here: https://gist.github.com/danieleggert/4761500

Daniel Eggert
  • 6,547
  • 2
  • 23
  • 40
  • Do you want the image button as an attachment? Alternatively, you can do an inline IMG using a base64 encoding. http://stackoverflow.com/questions/1527351/how-to-add-an-uiimage-in-mailcomposer-sheet-of-mfmailcomposeviewcontroller-in-ip/2461451#2461451 Or, obviously, reference image on the web. – Rob Feb 12 '13 at 11:33
  • The image is showing up, but users can't click on them to take them to the URL specified in the `a`-tags `href`. – Daniel Eggert Feb 12 '13 at 12:22
  • perhaps rather upload the images to a server. Then, in the HTML, reference the image URL rather than using CID – SQLGuru Feb 12 '13 at 12:27
  • I fixed the `

    ` -- sadly didn't help. It has always worked when viewing the email on a desktop, but not when viewing on an iPhone.

    – Daniel Eggert Feb 12 '13 at 15:46

1 Answers1

0

When I changed it from the attachment to an inline image, of the form <img src="data:image/png;base64,iVBORw0K ..."> (taking out the line breaks in the base64 string, too), it worked fine (when I got the email on both my computer and my iPhone, I could click the link without incident). Admittedly I did this using MFMailComposeViewController, but I assume it would work using whatever technique you're using for your multipart email.

Rob
  • 371,891
  • 67
  • 713
  • 902