Я потратил два дня на реализацию этого, но безуспешно. Я использую код проекта SMTPSender, представленный на http://code.google.com/p/skpsmtpmessage/source/checkout ... демонстрационный проект работает отлично!
но когда я копирую файлы классов в свой проект (как в инструкциях), он собирается и работает нормально. Но когда я пытаюсь отправить электронное письмо ... выдается следующая ошибка.
C: Attempting to connect to server at: smtp.gmail.com:25
2011-04-21 17:42:29.183 LocaliphoneAppRequest[5517:207] C: Attempting to connect to server at: smtp.gmail.com:465
2011-04-21 17:42:37.183 LocaliphoneAppRequest[5517:207] C: Attempting to connect to server at: smtp.gmail.com:587
2011-04-21 17:42:37.546 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.549 LocaliphoneAppRequest[5517:207] S: 220 mx.google.com ESMTP l5sm941912wej.32
2011-04-21 17:42:37.553 LocaliphoneAppRequest[5517:207] C: EHLO localhost
2011-04-21 17:42:37.557 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:37.741 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.742 LocaliphoneAppRequest[5517:207] S: 250-mx.google.com at your service, [119.153.117.81]
2011-04-21 17:42:37.743 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.744 LocaliphoneAppRequest[5517:207] S: 250-SIZE 35882577
2011-04-21 17:42:37.745 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.747 LocaliphoneAppRequest[5517:207] S: 250-8BITMIME
2011-04-21 17:42:37.748 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.749 LocaliphoneAppRequest[5517:207] S: 250-STARTTLS
2011-04-21 17:42:37.754 LocaliphoneAppRequest[5517:207] C: STARTTLS
2011-04-21 17:42:37.755 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:37.756 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.759 LocaliphoneAppRequest[5517:207] S: 250 ENHANCEDSTATUSCODES
2011-04-21 17:42:37.937 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.939 LocaliphoneAppRequest[5517:207] S: 220 2.0.0 Ready to start TLS
2011-04-21 17:42:37.942 LocaliphoneAppRequest[5517:207] Beginning TLSv1...
2011-04-21 17:42:37.944 LocaliphoneAppRequest[5517:207] C: EHLO localhost
2011-04-21 17:42:38.675 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:38.861 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.861 LocaliphoneAppRequest[5517:207] S: 250-mx.google.com at your service, [119.153.117.81]
2011-04-21 17:42:38.863 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.864 LocaliphoneAppRequest[5517:207] S: 250-SIZE 35882577
2011-04-21 17:42:38.867 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.869 LocaliphoneAppRequest[5517:207] S: 250-8BITMIME
2011-04-21 17:42:38.872 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.874 LocaliphoneAppRequest[5517:207] S: 250-AUTH LOGIN PLAIN XOAUTH
2011-04-21 17:42:38.875 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.879 LocaliphoneAppRequest[5517:207] S: 250 ENHANCEDSTATUSCODES
2011-04-21 17:42:38.880 LocaliphoneAppRequest[5517:207] -[NSConcreteMutableData encodeBase64ForData]: unrecognized selector sent to instance 0x6a67190
2011-04-21 17:42:38.914 LocaliphoneAppRequest[5517:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData encodeBase64ForData]: unrecognized selector sent to instance 0x6a67190'
Мой код
SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
testMsg.fromEmail = @"mygmail@gmail.com";
testMsg.toEmail = @"myanothergmail@gmail.com";
testMsg.relayHost = @"smtp.gmail.com";
testMsg.requiresAuth = YES;
testMsg.login = @"mygmail@gmail.com";
testMsg.pass = @"mypass";
testMsg.subject = @"test message";
// testMsg.bccEmail = @"testbcc@test.com";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
// Only do this for self-signed certs!
// testMsg.validateSSLChain = NO;
testMsg.delegate = self;
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
@"This is a test message.",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
testMsg.parts = [NSArray arrayWithObjects:plainPart,nil];
[testMsg send];
Пожалуйста, помогите мне .....: (