我正在使用SKPSMTPMessage
文件发送邮件,但在发送电子邮件时显示以下错误
Error Domain=SKPSMTPMessageError
Code=535 "Invalid username or password."
UserInfo=0xaa2de20 {NSLocalizedRecoverySuggestion=Go to Email Preferences in the application and re-enter your username and password.,
NSLocalizedDescription=Invalid username or password.}
我应该在哪里更改用户名和密码?代码如下:
SKPSMTPMessage *msg = [[SKPSMTPMessage alloc] init];
msg.fromEmail = @"123456789s@gmail.com";
msg.toEmail = to;
msg.relayHost = @"smtp.gmail.com";
msg.requiresAuth = YES;
msg.login = @"123456789@gmail.com";
msg.pass = @"123456789//";
msg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
msg.subject = [NSString stringWithFormat:@"Check Out %@ by Docstoc", self.navigationItem.title];
msg.delegate = self;
NSMutableArray *msg_parts = [NSMutableArray array];
NSDictionary *plain_text_part = [NSDictionary dictionaryWithObjectsAndKeys:
@"text/html\r\n\tcharset=UTF-8;\r\n\tformat=flowed", kSKPSMTPPartContentTypeKey,
[message stringByAppendingString:@"\n"], kSKPSMTPPartMessageKey,
nil];
[msg_parts addObject:plain_text_part];
msg.parts = msg_parts;
[msg send];
注意:这是完美的工作代码。自上周以来,它一直在显示错误。