import MessageUI
//MARK: MessageUI (EMAIL)
extension MyController: MFMailComposeViewControllerDelegate
{
func sendEmail()
{
if MFMailComposeViewController.canSendMail()
{
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(["mxnuelsg@gmail.com"])
mail.setSubject("Feedback from \(Bundle.main.infoDictionary!["CFBundleDisplayName"] ?? String())")
mail.setMessageBody("<p>Hi Manuel!</p>", isHTML: true)
present(mail, animated: true)
}
else
{
// show failure alert
}
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?)
{
controller.dismiss(animated: true)
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.