0
任何人都知道在iPhone應用程序中使用的objective-c smtp庫。iphone smtp客戶端庫
我使用skpsmtpmessage http://code.google.com/p/skpsmtpmessage/,但發送郵件到Gmail時發送郵件正文作爲附件。
謝謝。
任何人都知道在iPhone應用程序中使用的objective-c smtp庫。iphone smtp客戶端庫
我使用skpsmtpmessage http://code.google.com/p/skpsmtpmessage/,但發送郵件到Gmail時發送郵件正文作爲附件。
謝謝。
嘗試使用https://github.com/MailCore/mailcore2。它是異步的並支持大多數郵件協議。
看那發送郵件舉例:
MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init];
smtpSession.hostname = @"smtp.gmail.com";
smtpSession.port = 465;
smtpSession.username = @"[email protected]";
smtpSession.password = @"password";
smtpSession.authType = MCOAuthTypeSASLPlain;
smtpSession.connectionType = MCOConnectionTypeTLS;
MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
MCOAddress *from = [MCOAddress addressWithDisplayName:@"Matt R"
mailbox:@"[email protected]"];
MCOAddress *to = [MCOAddress addressWithDisplayName:nil
mailbox:@"[email protected]"];
[[builder header] setFrom:from];
[[builder header] setTo:@[to]];
[[builder header] setSubject:@"My message"];
[builder setHTMLBody:@"This is a test message!"];
NSData * rfc822Data = [builder data];
MCOSMTPSendOperation *sendOperation =
[smtpSession sendOperationWithData:rfc822Data];
[sendOperation start:^(NSError *error) {
if(error) {
NSLog(@"Error sending email: %@", error);
} else {
NSLog(@"Successfully sent email!");
}
}];
那麼你沒有正確使用它。你能提供代碼嗎?這可能有幫助。 – 2010-12-17 17:50:26
現在我使用「MFMailComposeViewController」它是「MessageUI.framework」的一部分 http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html – aminhotob 2010-12-19 14:13:31