ios发邮件

 1 用自带的邮件客户端,发完邮件后不会自动回到原应用 2 NSURL *url = [NSURL URLWithString:@"mailto://10010@qq.com"]; 3 [[UIApplication sharedApplication] openURL:url]; 

 

 1 跟发短信的第2种方法差不多,只不过控制器类名叫做:MFMailComposeViewController
 2 
 3 邮件发送后的代理方法回调,发完后会自动回到原应用
 4 - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
 5 {
 6     // 关闭邮件界面
 7     [controller dismissViewControllerAnimated:YES completion:nil];
 8     
 9     if (result == MFMailComposeResultCancelled) {
10         NSLog(@"取消发送");
11     } else if (result == MFMailComposeResultSent) {
12         NSLog(@"已经发出");
13     } else {
14         NSLog(@"发送失败");
15     }
16 }

 

posted @ 2016-01-25 14:16  xiaocaoera  阅读(388)  评论(0编辑  收藏  举报