4

我正在使用 SKPSMTPMessage 发送电子邮件。它在模拟器中运行良好,但是当我在 iPad 上尝试时,它会发送邮件,但之后它会崩溃。我的中继主机是

 testMsg.relayHost = @"smtp.gmail.com"

问题出在哪里??谁能帮我

提前致谢

编辑:错误:

 2012-09-11 16:10:02.824[2902:707] C: Attempting to connect to server at: smtp.gmail.com:25
 2012-09-11 16:10:03.368 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:03.370 [2902:707] S: 220 mx.google.com ESMTP iq3sm9573874pbc.5
 2012-09-11 16:10:03.371 [2902:707] C: EHLO localhost

 2012-09-11 16:10:03.373 [2902:707] *** starting short watchdog ***
 2012-09-11 16:10:03.475 [2902:707] 0
 2012-09-11 16:10:03.476 [2902:707] 0
 2012-09-11 16:10:03.522 [2902:707] 0
 2012-09-11 16:10:03.854 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:03.855 [2902:707] S: 250-mx.google.com at your service, [112.196.5.2]
 2012-09-11 16:10:03.856 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:03.857 [2902:707] S: 250-SIZE 35882577
 2012-09-11 16:10:03.858 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:03.858 [2902:707] S: 250-8BITMIME
 2012-09-11 16:10:03.859 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:03.861 [2902:707] S: 250-STARTTLS
 2012-09-11 16:10:03.862 [2902:707] C: STARTTLS

 2012-09-11 16:10:03.863 [2902:707] *** starting short watchdog ***
 2012-09-11 16:10:03.864 [2902:707] *** stopping watchdog ***
 2 012-09-11 16:10:03.865 [2902:707] S: 250 ENHANCEDSTATUSCODES
 2012-09-11 16:10:04.108 [2902:707] *** stopping watchdog ***
 2012-09-11 16:10:04.110 [2902:707] S: 220 2.0.0 Ready to start TLS
 2012-09-11 16:10:04.112 [2902:707] Beginning TLSv1...
 2012-09-11 16:10:04.113 [2902:707] C: EHLO localhost

 2012-09-11 16:10:05.088 [2902:707] *** starting short watchdog ***
  2012-09-11 16:10:05.332 [2902:707] *** stopping watchdog ***
  2012-09-11 16:10:05.334 [2902:707] S: 250-mx.google.com at your service, [112.196.5.2]
 2012-09-11 16:10:05.335 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.336 [2902:707] S: 250-SIZE 35882577
2012-09-11 16:10:05.337 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.337 [2902:707] S: 250-8BITMIME
2012-09-11 16:10:05.338 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.339 [2902:707] S: 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
2012-09-11 16:10:05.340 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.340 [2902:707] S: 250 ENHANCEDSTATUSCODES
2012-09-11 16:10:05.341 [2902:707] C: AUTH PLAIN AGJyZWFraW4ucmVwb3J0QGdtYWlsLmNvbQBicmVha2luLnJlcG9ydA==

2012-09-11 16:10:05.342 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.074 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.075 [2902:707] S: 235 2.7.0 Accepted
2012-09-11 16:10:06.077 [2902:707] C: MAIL FROM:<xyz@gmail.com> BODY=8BITMIME

2012-09-11 16:10:06.078 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.321 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.323 [2902:707] S: 250 2.1.0 OK iq3sm9573874pbc.5
2012-09-11 16:10:06.324 [2902:707] C: RCPT TO:<abc@com>

2012-09-11 16:10:06.326 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.566 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.568 [2902:707] S: 250 2.1.5 OK iq3sm9573874pbc.5
2012-09-11 16:10:06.569 [2902:707] C: DATA

2012-09-11 16:10:06.570 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:07.644 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:07.646 [2902:707] S: 354  Go ahead iq3sm9573874pbc.5
2012-09-11 16:10:07.656 [2902:707] *** starting long watchdog ***
2012-09-11 16:10:12.645 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:12.647 [2902:707] *** stopping watchdog ***
(lldb) 

这里 self.watchdogTimer = nil; EXC_BAD_ACCESS

4

2 回答 2

0

两年后我也遇到过这个问题。可能对某人有用我的解决方案:

@implementation SMTPEmailManager
{
    SKPSMTPMessage* _smtpMessage;
}

- (void) sendMessage
{
    ...
    _smtpMessage = [[SKPSMTPMessage alloc] init];
    _smtpMessage.relayHost = @"smtp.gmail.com";
    ...

    [_smtpMessage send];
}

- (void) messageSent: (SKPSMTPMessage*) message
{
    _smtpMessage = nil;
    ...    
}
于 2014-11-23T07:42:41.773 回答
0

您是否将任何附件与您的电子邮件一起发送?如果是,那么您必须使用相关的 MIME 类型。

于 2012-09-11T10:32:28.250 回答