I would like to send an e-mail from my app. I have solved the problem so far and the sending also works flawlessly:
func showMailComposer() {
guard MFMailComposeViewController.canSendMail() else {
return
}
let composer = MFMailComposeViewController()
composer.mailComposeDelegate = self
composer.setToRecipients(["[email protected]"])
composer.setSubject("example")
composer.setMessageBody(""
, isHTML: false)
present(composer, animated: true)
}
Now I would like to send a signature, that was made by the user, with the mail. I already exported the signature as UIImage.
Now I do not know how I can attach the UIImage to the mail.
How do you do that?
Many thanks in advance!
You can add attachment data using this api - https://developer.apple.com/documentation/messageui/mfmailcomposeviewcontroller/1616885-addattachmentdata
From the docs -
UPDATE
For the attached screenshot -
The call would look like -