Sending email with Swift is easy with MFMailComposeViewController. Follow these steps:
Step 1: Import the MessageUI framework
import MessageUI
Step 2: Add the Protocol to your ViewController
MFMailComposeViewControllerDelegate
Step 3: Add the delegate method
func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
controller.dismissViewControllerAnimated(true, completion: nil)
}
Step 4: Make an instance of the MailComposeViewController, and present it.
func sendEmail() {
let mailVC = MFMailComposeViewController()
mailVC.mailComposeDelegate = self
mailVC.setToRecipients([])
mailVC.setSubject("Message Subject")
mailVC.setMessageBody("Message text...", isHTML: true)
presentViewController(mailVC, animated: true, completion: nil)
}
https://gist.github.com/ed9b0ad90ca0937aac62.git