Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. class ContactViewController: UIViewController, MFMailComposeViewControllerDelegate {
  2.  
  3. override func viewDidLoad() {
  4. super.viewDidLoad()
  5. }
  6.  
  7. @IBAction func emailSenden(_ sender: Any) {
  8.  
  9. if !MFMailComposeViewController.canSendMail() {
  10. print("Mail services are not available")
  11. return
  12. } else {
  13. let mail = MFMailComposeViewController()
  14. mail.mailComposeDelegate = self
  15. mail.setToRecipients(["someone@example.com"])
  16. mail.setSubject("Message to you")
  17. mail.setMessageBody("Hallo,n", isHTML: false)
  18.  
  19. present(mail, animated: true, completion: nil)
  20.  
  21. mail.dismiss(animated: true, completion: nil)
  22. }
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement