Create compose mail when click button iOS swift

Solution:

            let receivers = event.receivers != nil ? [receivers] : []

            

            let mailComposerVC = MFMailComposeViewController()

            mailComposerVC.mailComposeDelegate = self   // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property

            

            mailComposerVC.setToRecipients(receivers asNSArray as? [String])

            mailComposerVC.setSubject"")

            mailComposerVC.setMessageBody("", isHTML: false)

            self.viewControl.present(mailComposerVC, animated: true, completion: nil)



The above code you have to implement in the action of the button.


receivers are the receiving mail id arrays you can pass.Also must have to implement the delegate in the viewController and delegate methods.


Comments

Popular posts from this blog

How to blink a button iOS swift?

Convert NsNumber, NSDate to String in iOS Swift

Parse the value from string value iOS swift