let shareemail = ""
let sharesubject = "Get the Powerball Advantage App!"
if MFMailComposeViewController.canSendMail() {
let mailComposerVC = MFMailComposeViewController()
mailComposerVC.mailComposeDelegate = self
mailComposerVC.setToRecipients([shareemail])
mailComposerVC.setSubject(sharesubject)
mailComposerVC.setMessageBody("Get it now in the Apple App Store!<br><br>https://itunes.apple.com/us/app/powerball-advantage/id1333792420?mt=8", isHTML: true)
self.present(mailComposerVC, animated: true, completion: nil)
} else {
let coded = "mailto:\(shareemail)?subject=\(sharesubject)&body=Get it now in the Apple App Store!%0A%0Ahttps://itunes.apple.com/us/app/powerball-advantage/id1333792420?mt=8".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
if let emailURL = URL(string: coded!){
if UIApplication.shared.canOpenURL(emailURL){
UIApplication.shared.open(emailURL, options: [:], completionHandler: { (result) in
if !result {
// show some Toast or error alert
//("Your device is not currently configured to send mail.")
}
})
}
}
}