Demens Deum
Demens Deum

Reputation: 154

Let the user choose an e-mail client on iOS

We would like to give the ability to the user to choose any installed email client (Gmail, Yandex, etc.) in our app. But iOS provides only Mail or builtin MFMailComposeViewController. Is there any way to present a list of email clients to the user?

Upvotes: 6

Views: 3870

Answers (3)

Andrea Gottardo
Andrea Gottardo

Reputation: 1369

There's no way to achieve this directly, as iOS doesn't know the concept of 'default application'. You could implement yourself a function which checks the various URLs used by different iOS email clients, and determines which clients are installed. For instance, GMail uses googlegmail://. You could also show a menu with the clients found on the device.

If you don't want to create your own implementation, ThirdPartyMailer is a library that can do this for you.

Upvotes: 9

Maxime
Maxime

Reputation: 1392

You should try something like this:

let url = NSURL(string: "mailto:[email protected]")
UIApplication.sharedApplication().openURL(url)

Upvotes: -3

phi
phi

Reputation: 10733

If you're looking for something similar to the way Android handles it, then no it's not possible. Some email apps though might support a custom scheme - for example Gmail uses googlegmail:// (taken from this question).

Upvotes: 1

Related Questions