Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 343
Andrea Miotto Avatar asked Oct 09 '17 15:10

Andrea Miotto


1 Answers

I resolved using the following code:

   let mailURL = URL(string: "message://")!
   if UIApplication.shared.canOpenURL(mailURL) {
       UIApplication.shared.open(mailURL, options: [:], completionHandler: nil)
    }
like image 160
Andrea Miotto Avatar answered Oct 22 '22 15:10

Andrea Miotto