Mailcore2 使用SMTP发送邮件 Domain=MCOErrorDomain Code=30 的解决方案

smtp发送邮件的逻辑是 先要连接到smtp服务器使用 loginOperation 成功后,才能使用 sendOperationWithData 发送操作,

后来要做一些配置优化,使用了 checkAccountOperationWithFrom 然后在进行 loginOperation 的操作导致发送邮件会报如下错误

Error Domain=MCOErrorDomain Code=30 "An error occurred while sending the message." UserInfo={NSLocalizedDescription=An error occurred while sending the message.}

smtp发送日志打印

[SMTP] MAIL FROM:<wtest202107@xxxx.com> SIZE=818
[SMTP] 503 5.5.2 Sender already specified

解决方案:

在login的时候只能使用 loginOperation 而不能使用 checkAccountOperationWithFrom ,之后发送邮件就能成功发送

参考链接

[]: https://stackoverflow.com/questions/27825359/smtp-an-error-occurred-while-sending-the-message

posted @ 2021-07-30 10:22  大卫的梦呓  阅读(309)  评论(0编辑  收藏  举报