Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save leoiphonedev/272de997e5050304fda8b8ff69a58e7e to your computer and use it in GitHub Desktop.
Save leoiphonedev/272de997e5050304fda8b8ff69a58e7e to your computer and use it in GitHub Desktop.
Code for presenting mail composer (desfualt) when user tap on send mail button
@IBAction func sendEmail(_ sender: Any) {
if MFMailComposeViewController.canSendMail() {
let mailComposer = MFMailComposeViewController()
mailComposer.setSubject("Update about ios tutorials")
mailComposer.setMessageBody("What is the update about ios tutorials on youtube", isHTML: false)
mailComposer.setToRecipients(["[email protected]"])
self.present(mailComposer, animated: true
, completion: nil)
} else {
print("Email is not configured in settings app or we are not able to send an email")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment