Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ContactViewController: UIViewController, MFMailComposeViewControllerDelegate {
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- @IBAction func emailSenden(_ sender: Any) {
- if !MFMailComposeViewController.canSendMail() {
- print("Mail services are not available")
- return
- } else {
- let mail = MFMailComposeViewController()
- mail.mailComposeDelegate = self
- mail.setToRecipients(["someone@example.com"])
- mail.setSubject("Message to you")
- mail.setMessageBody("Hallo,n", isHTML: false)
- present(mail, animated: true, completion: nil)
- mail.dismiss(animated: true, completion: nil)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement