16

Evening, I'm trying to open the inbox mail of the Mail app from a button action...

In the web I saw that is possibile to open the email app the the EmailComposer object.. but I'm not trying to make a new email, I just want the user checks the emails.

Any tips?

Andrea Miotto
  • 7,084
  • 8
  • 45
  • 70
  • 2
    Possible duplicate of [Launch Apple Mail App from within my own App?](https://stackoverflow.com/questions/8821934/launch-apple-mail-app-from-within-my-own-app) – Paolo Oct 09 '17 at 15:44

1 Answers1

43

I resolved using the following code:

   let mailURL = URL(string: "message://")!
   if UIApplication.shared.canOpenURL(mailURL) {
       UIApplication.shared.open(mailURL, options: [:], completionHandler: nil)
    }
Andrea Miotto
  • 7,084
  • 8
  • 45
  • 70