Question

I was putting together a mobile website, and I wanted to create an email link that lets the user send links to their searches to other email address. The mailto link I generated works fine in Chrome, IE, and Safari for the iPad. But on Safari for the iPhone, the link fails to bring up the default mail client.

<a title="Send search link" href="mailto:?subject=Check%20out%20Bob&body=http%3A%2F%2Fwww.example.com%2FPeopleSearch%2F%3Fname%3DBob">Email your search results</a>
Was it helpful?

Solution

After a lot of testing, and a lot of reading, I stumbled across this link to the iOS developer's website:

https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/MailLinks/MailLinks.html

The key was this: "When specifying a mailto URL, you must provide the target email address."

Basically, safari for iPhone requires a target email address in the mailto. With most other browsers, you can leave it blank. To fix the issue, I inserted a dummy email address to make it work.

<a title="Send search link" href="mailto:remove_this@email.com?subject=Check%20out%20Bob&body=http%3A%2F%2Fwww.example.com%2FPeopleSearch%2F%3Fname%3DBob">Email your search results</a>

EDIT: This issue may no longer be the case for Safari browsers for iPhone version 7+.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top