If you want to send an email from within the application, you can take a look at MFMailComposeViewController
You can simply instantiate this view controller, set the fields as subject, cc... and present it.
Taken from the documentation:
- Check that the service is available (it's not available in the simulator, for example)
if !MFMailComposeViewController.canSendMail() {
print("Mail services are not available")
return
}
- Instantiate the view controller, set the delegate and present it
let composeVC = MFMailComposeViewController()
composeVC.mailComposeDelegate = self
// Configure the fields of the interface.
composeVC.setToRecipients(["address@example.com"])
composeVC.setSubject("Hello!")
composeVC.setMessageBody("Hello from California!", isHTML: false)
// Present the view controller modally.
self.present(composeVC, animated: true, completion: nil)
- Dismiss when the mail is sent or the user cancelled
func mailComposeController(controller: MFMailComposeViewController,
didFinishWithResult result: MFMailComposeResult, error: NSError?) {
// Check the result or perform other tasks.
// Dismiss the mail compose view controller.
controller.dismiss(animated: true, completion: nil)
}