iOS调起系统邮箱
来源:互联网 发布:mac迅雷 编辑:程序博客网 时间:2024/05/16 00:33
调起系统邮箱
1.引入MessageUI.framework框架
2.添加头文件
#import <MessageUI/MFMailComposeViewController.h>
具体代码片段
-(void)openSystemEmail{ // Email Content //c方法,填写系统结构体内容,返回值为0,表示成功。 NSString *messageBody = [NSString stringWithFormat:@"Model:%@\n%@\nApp: %@\nFeedback here:\n",[[UIDevice currentDevice] systemVersion],[SystemSetting getDeviceModel], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]; // To address NSArray *toRecipents = [NSArray arrayWithObject:@"your emails "]; MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init]; mc.mailComposeDelegate = self; [mc setSubject:@"我的建议"];//邮件主题 [mc setMessageBody:messageBody isHTML:NO];//邮件部分内容 [mc setToRecipients:toRecipents];//发送地址 [mc.navigationBar setTintColor:[UIColor whiteColor]]; // Present mail view controller on screen if (!mc) { return; }else{ [self presentViewController:mc animated:YES completion:NULL]; }}
#pragma mark 调起系统邮箱的代理方法- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{ NSString*message; switch (result) { case MFMailComposeResultCancelled: NSLog(@"Mail cancelled"); //message=[NSString stringWithFormat:@"%@",@"Mail cancelled"]; break; case MFMailComposeResultSaved: NSLog(@"Mail saved"); // message=[NSString stringWithFormat:@"%@",@"Mail saved"]; break; case MFMailComposeResultSent: NSLog(@"Mail sent"); // message=[NSString stringWithFormat:@"%@",@"Mail sent"]; break; case MFMailComposeResultFailed: NSLog(@"Mail sent failure: %@", [error localizedDescription]); message=[NSString stringWithFormat:@"%@",[error localizedDescription]]; [[[UIAlertView alloc]initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil] show ]; break; default: break; } [self dismissViewControllerAnimated:YES completion:NULL];}
0 0
- iOS调起系统邮箱
- iOS调起打电话
- IOS JS调起APP
- 调起系统拨打电话
- 今日起更换联系邮箱!
- iOS如何调起地图进行导航(高德,百度,系统自带)(URI)
- 邮箱系统
- 应用调起iOS百度地图方式
- iOS中Schema调起APP
- cordova iOS 调起通讯录崩溃问题
- Unity与iOS相互调起、交互
- ios 集成qq支付 无法调起
- iOS 调起地图App进行导航(百度,高德,系统自带高德)URL API方式
- iOS 调起地图App进行导航(百度,高德,系统自带高德)URL API方式
- IOS系统网易邮箱密码不正确的解决方法
- ios 简单的使用系统邮箱发送邮件
- iOS-html调起APP并传参
- iOS 一个程序 调起另外一个程序
- 利用百度API(JavaScript 版)实现在地图上绘制任一多边形,并判断给定经纬度是否在多边形范围内。以及两点间的测距功能
- Open Source iOS Apps – Real iOS Source Code Examples
- 美图面试问到的一个题:求一个字符串中第一个仅出现一次的字符
- 新唐N32926调试--wifi模块移植
- FontFamily 和Font 的区别
- iOS调起系统邮箱
- Maven学习记录1——什么是 Maven
- linux epoll poll select
- Memcache,Redis,MongoDB(数据缓存系统)方案对比与分析
- SE37 创建PO订单BAPI_PO_CREATE1
- Android 混淆代码总结
- SSL双向认证原理以及期间证书的使用
- DB2怎么根据开始和结束时间算相隔天数
- nil、NULL和NSNull