How can I send mail from an iPhone application

前端 未结 11 1750
甜味超标
甜味超标 2020-11-22 11:47

I want to send an email from my iPhone application. I have heard that the iOS SDK doesn\'t have an email API. I don\'t want to use the following code because it will exit my

11条回答
  •  难免孤独
    2020-11-22 12:21

    Swift 2.0

    func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?){
        if let error = error{
            print("Error: \(error)")
        }else{
            //NO Error
            //------------------------------------------------
            var feedbackMsg = ""
    
            switch result.rawValue {
            case MFMailComposeResultCancelled.rawValue:
                feedbackMsg = "Mail Cancelled"
            case MFMailComposeResultSaved.rawValue:
                feedbackMsg = "Mail Saved"
            case MFMailComposeResultSent.rawValue:
                feedbackMsg = "Mail Sent"
            case MFMailComposeResultFailed.rawValue:
                feedbackMsg = "Mail Failed"
            default:
                feedbackMsg = ""
            }
    
            print("Mail: \(feedbackMsg)")
    
            //------------------------------------------------
        }
    }
    

提交回复
热议问题