Andre
Andre

Reputation: 7658

iOS Swift: Open Mail app in inbox emails

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?

Upvotes: 18

Views: 11024

Answers (1)

Andre
Andre

Reputation: 7658

I resolved using the following code:

   let mailURL = URL(string: "message://")!
   if UIApplication.shared.canOpenURL(mailURL) {
       UIApplication.shared.open(mailURL, options: [:], completionHandler: nil)
    }

Upvotes: 43

Related Questions