In Android, I can launch an email client from my android application using its Intent mechanism. In ios, how can I launch its email client from my ios application using Swift?
Thank you.
Show activity on this post. let email = "[email protected]" let url = URL(string: "mailto:\(email)") UIApplication. shared. openURL(url!)
The current version of Apple Mail utilizes SMTP for message sending, POP3, Exchange and IMAP for message retrieval and S/MIME for end-to-end message encryption.
Updated for Xcode 12.5
let url = NSURL(string: "mailto:mailto:[email protected]")
UIApplication.shared.open(url! as URL)
or if you would like to add an embedded subject
let url = NSURL(string: "mailto:[email protected]?subject=This%20is%20the%20subject&[email protected]&body=This%20is%20the%20body")
or if you want to add multiple email addresses
let url = NSURL(string: "mailto:mailto:[email protected],[email protected]")
UIApplication.shared.open(url! as URL)
let url = NSURL(string: "mailto:[email protected]")
UIApplication.sharedApplication().openURL(url)
Note that this works only on a device, not in the simulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With