iOS - 确保应用内电子邮件通过

时间:2012-03-05 01:02:45

标签: ios email sms verify

如果我有一个应用程序向应用程序内的用户朋友发送电子邮件或短信,我该怎么检查以确保邮件已经通过并成功发送,或者是否已经阻止了服务消息成功发送,什么不能或不能这样做?

1 个答案:

答案 0 :(得分:2)

要查看从您的应用发送电子邮件的结果,您应该实施委托方法mailComposeController:didFinishWithResult:result:error

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    if (result == MFMailComposeResultSent) {
        // email was sent successfully
    } else if (result == MFMailComposeResultFailed) {
        // email failed to send
        NSLog(@"mail send error: %@", [error localizedDescription]);
    }
}

务必将MFMailComposeViewController的代表设置为self

Apple docs reference here

当然,这只会告诉您电子邮件是否已成功已发送。实际上没有办法知道电子邮件是在收件人端交付