欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

iphone发送邮件html,iPhone使用smtp服务器发送电子邮件?

发布时间:2025/3/20 编程问答 36 豆豆
生活随笔 收集整理的这篇文章主要介绍了 iphone发送邮件html,iPhone使用smtp服务器发送电子邮件? 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

在我的应用程序中,我能够使用smtp服务器发送电子邮件,因为我输入了正确的电子邮件ID和密码.

但当我输入我的Gmail或雅虎帐户详细信息时,我无法发送邮件.

因为我设置了relayHost = @“smtp.gmail.com”;然后我也无法发送邮件.

请帮我解决这个问题.

以下是我的代码:

-(void)sendEMAIL{

SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];

testMsg.fromEmail = str_uname;

NSLog(@"str_Uname=%@",testMsg.fromEmail);

testMsg.toEmail = str_info;

NSLog(@"autoemail=%@",testMsg.toEmail);

testMsg.relayHost = @"smtp.gmail.com";

testMsg.requiresAuth = YES;

testMsg.login = str_uname;

NSLog(@"autoelogin=%@",testMsg.login);

testMsg.pass = str_password;

NSLog(@"autopass=%@",testMsg.pass);

testMsg.subject = @"Schedule Sms And Email";

testMsg.wantsSecure = YES;

NSString *sendmsg=[[NSString alloc]initWithFormat:@"%@",str_info2];

NSLog(@"automsg=%@",sendmsg);

testMsg.delegate = self;

NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,

sendmsg, kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];

testMsg.parts = [NSArray arrayWithObjects:plainPart,nil];

[testMsg send];

}

-(void)messageSent:(SKPSMTPMessage *)message{

[message release];

}

-(void)messageFailed:(SKPSMTPMessage *)message error:(NSError *)error{

[message release];

}

总结

以上是生活随笔为你收集整理的iphone发送邮件html,iPhone使用smtp服务器发送电子邮件?的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。