【问题标题】:MAILCORE2 - A stable connection to the server could not be establishedMAILCORE2 - 无法建立与服务器的稳定连接
【发布时间】:2021-01-06 20:17:14
【问题描述】:

我在我们的 Xcode 项目 Cobj 中设置了 MailCore2 插件,但它不起作用...我的电子邮件地址是 Apple 帐户 ....@mac.com 我的详细信息是:

#define kmailAdminHost          @"smtp.mail.me.com"
#define kmailAdminUser          @"<apple email address>" 
#define kmailAdminPassword      @"<password>"
#define kmailAdminPort          587

    smtpSession.hostname = kmailAdminHost;
    smtpSession.port     = kmailAdminPort;
    smtpSession.username = kmailAdminUser;
    smtpSession.password = kmailAdminPassword;
    smtpSession.connectionType = MCOConnectionTypeTLS;
    smtpSession.authType = MCOAuthTypeSASLPlain;
    smtpSession.checkCertificateEnabled = false ;
    smtpSession.timeout = 30.0;

怎么了?我收到错误 -> 无法建立与服务器的稳定连接。

【问题讨论】:

    标签: ios xcode mailcore2


    【解决方案1】:

    大家好,我也遇到了同样的情况,发现在像这样更改端口地址和身份验证类型后,这段代码对我有用。

            smtpSession.hostname = "smtp.gmail.com"
            smtpSession.username = "........."
            smtpSession.password = "........."
            smtpSession.port = 465
            smtpSession.authType = MCOAuthType.saslPlain
            smtpSession.connectionType = MCOConnectionType.TLS
            smtpSession.connectionLogger = {(connectionID, type, data) in
                if data != nil {
                    if let string = NSString(data: data!, encoding: String.Encoding.utf8.rawValue){
                        NSLog("Connectionlogger: \(string)")
                    }
                }
            }
    

    【讨论】:

      猜你喜欢
      • 2018-11-28
      • 2015-06-13
      • 2017-08-31
      • 2016-04-04
      • 2016-12-21
      • 2020-04-06
      • 2012-10-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多