0
努力遵循: http://libmailcore.com/gettingstarted.htmllibmailcore:無法連接到我的Gmail帳戶
-(void) testSend{
CTCoreMessage *msg = [[CTCoreMessage alloc] init];
CTCoreAddress *toAddress = [CTCoreAddress addressWithName:@"Monkey"
email:@"[email protected]"];
[msg setTo:[NSSet setWithObject:toAddress]];
[msg setBody:@"This is a test message!"];
NSError *error;
BOOL success = [CTSMTPConnection sendMessage:msg
server:@"smtp.gmail.com"
username:@"[email protected]"
password:@"......"
port:587
connectionType:CTSMTPConnectionTypeStartTLS
useAuth:YES
error:&error];
if(success){
NSLog(@"%s","SUCESS SEND");
}else{
NSLog(@"%s","FAILED SEND");
}
}
它的工作原理
-(void) testGet{
CTCoreAccount *account = [[CTCoreAccount alloc] init];
BOOL success = [account connectToServer:@"imap.gmail.com"
port:993
connectionType:CTConnectionTypePlain
authType:CTImapAuthTypePlain
login:@"........"
password:@"......."];
if(success){
NSLog(@"%s","SUCESS GET");
}else{
NSLog(@"%s","FAILED GET");
}
}
它不工作
哪裏是我的錯?