Search code examples
iosswiftxcode7.3

Issue in sending email


I am working on an example that is for sending an email using Swift. I am using the following code:

@IBAction func sendMailButtonAction(sender: UIButton) {

        if MFMailComposeViewController.canSendMail() {
            let mail = MFMailComposeViewController()
            mail.mailComposeDelegate = self
            mail.setToRecipients(["[email protected]"])
            mail.setMessageBody("<p>You're so awesome!</p>", isHTML: true)
           // mail.addAttachmentData(<#T##attachment: NSData##NSData#>, mimeType: <#T##String#>, fileName: <#T##String#>)
            presentViewController(mail, animated: true, completion: nil)
        } else {
            print("Error Received While sending mail")        }

    }

When I click the send button of the MFMailComposeViewController() to send the mail, I receive the error in the device logs as:

>     1. <Error>: 18:32:54.282 [0x16e1bb000] >vibe> Error: Empty atoms array
>     2. ERROR:    [0x16e1bb000] 919: Vibe engine could not play vibe pattern, err = -50, actionID = 1001. Please file a bug.

Solution

  • The issue was with the server firewall of the organisation. It is blocking the server port to send the mail. Tried to send the mail using cellular network and it worked.