For sending email from your application you
first Add UIMessage Package from for Application then Write this Code and connect them at your Storyboard :
import UIKit
import MessageUI
class SendDropMailVC: UIViewController , MFMailComposeViewControllerDelegate {
@IBOutlet weak var subject: UITextField!
@IBOutlet weak var Body: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func SendEmail(_ sender: AnyObject) {
var SubjectText = "Your Subject:"
SubjectText += subject.text!
let messageBody = Body
let toRecients = ["123@email.com"]
let mc: MFMailComposeViewController = MFMailComposeViewController()
mc.mailComposeDelegate = self
mc.setSubject(SubjectText)
mc.setMessageBody((messageBody?.text)!, isHTML: false)
mc.setToRecipients(toRecients)
self.present(mc, animated: true, completion: nil)
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
switch result.rawValue{
case MFMailComposeResult.cancelled.rawValue:
NSLog("Mail Cancelled")
case MFMailComposeResult.saved.rawValue:
NSLog("Mail Saved")
case MFMailComposeResult.sent.rawValue:
NSLog("Mail Sent")
case MFMailComposeResult.failed.rawValue:
NSLog("Mail Sent Failure: %@" , [error!.localizedDescription])
default:
break
}
self.dismiss(animated: true, completion: nil)
}
Add a UITextField! & UITextView! to your view with a button as you see in the picture
if its not clear send me your message
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…!!..Swift Online Training
ReplyDeleteMmorpg oyunları
ReplyDeleteINSTAGRAM TAKİPÇİ SATIN AL
tiktok jeton hilesi
tiktok jeton hilesi
antalya saç ekimi
referans kimliği nedir
instagram takipçi satın al
Mt2 Pvp Serverler
instagram takipçi satın al
çekmeköy mitsubishi klima servisi
ReplyDeleteataşehir mitsubishi klima servisi
maltepe vestel klima servisi
kadıköy vestel klima servisi
ümraniye mitsubishi klima servisi
tuzla bosch klima servisi
tuzla arçelik klima servisi
çekmeköy samsung klima servisi
ataşehir samsung klima servisi