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