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?

iOS flutter while run to iPhone it had the error - Cannot find type 'PhoneNumberKit' in scope