我正在使用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
答案 0 :(得分:0)
您是否随电子邮件一起发送任何附件?如果是,则必须使用相关的MIME类型。
答案 1 :(得分:0)
两年后我也遇到过这个问题。可能对某些人来说我的解决方案很有用:
@implementation SMTPEmailManager
{
SKPSMTPMessage* _smtpMessage;
}
- (void) sendMessage
{
...
_smtpMessage = [[SKPSMTPMessage alloc] init];
_smtpMessage.relayHost = @"smtp.gmail.com";
...
[_smtpMessage send];
}
- (void) messageSent: (SKPSMTPMessage*) message
{
_smtpMessage = nil;
...
}