ios如何利用系统邮件发送邮件
来源:互联网 发布:儿童绘画软件排行 编辑:程序博客网 时间:2024/04/27 17:08
#pragma mark - 在应用内发送邮件//调出邮件发送窗口- (void)showMailPicker:(NSInteger)tag{ if ([MFMailComposeViewController canSendMail]){ [self displayMailComposerSheet:tag]; }else{ NSLog(@"Device not configured to send mail"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请配置邮件" message:@"请先设置邮件账户:'设置'->'邮件'->'添加帐号'" delegate:self cancelButtonTitle:@"好" otherButtonTitles:nil,nil]; [alert show]; //iOS8打开设定界面 // [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; // return; } }- (void)displayMailComposerSheet:(NSInteger)tag{ MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;// [picker setSubject:@"eMail主题"]; // // Set up recipients// NSString *email=detailArray[tag];// NSArray *toRecipients = [NSArray arrayWithObject:email];// //NSArray *ccRecipients = [NSArray arrayWithObjects:@"1528693256@qq.com", nil];// //NSArray *bccRecipients = [NSArray arrayWithObject:@"1528693256@qq.com"];// // [picker setToRecipients:toRecipients];//添加收件人// //[picker setCcRecipients:ccRecipients];//添加抄送// //[picker setBccRecipients:bccRecipients];//添加密送// // // Attach an image to the email// //NSString *path = [[NSBundle mainBundle] pathForResource:@"swift" ofType:@"png"];// //NSData *myData = [NSData dataWithContentsOfFile:path];// //[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"swift.png"];// // // 邮件正文// NSString *emailBody = @"测试";// [picker setMessageBody:emailBody isHTML:NO]; if (tag==4) { [picker setSubject:@"商务合作"]; NSString *email=detailArray[tag]; NSArray *toRecipients = [NSArray arrayWithObject:email]; [picker setToRecipients:toRecipients];//添加收件人 // 邮件正文 NSString *emailBody = @"内容: \n联系方式:"; [picker setMessageBody:emailBody isHTML:NO]; } else if(tag==5){ [picker setSubject:@"应聘(XXX职位)"]; NSString *email=detailArray[tag]; NSArray *toRecipients = [NSArray arrayWithObject:email]; [picker setToRecipients:toRecipients];//添加收件人 // 邮件正文 NSString *emailBody = @"内容:你好,我想加入飞磨的大家庭,成为飞磨公司的(XXX职位)\n个人简介:\n工作经验:"; [picker setMessageBody:emailBody isHTML:NO]; } [self presentViewController:picker animated:YES completion:NULL];}#pragma mark - MFMailComposeViewControllerDelegate- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{ //关闭邮件发送窗口 [self dismissViewControllerAnimated:YES completion:^{ }]; NSString *msg; switch (result) { case MFMailComposeResultCancelled: msg = @"用户取消编辑邮件"; break; case MFMailComposeResultSaved: msg = @"用户成功保存邮件"; break; case MFMailComposeResultSent: msg = @"用户点击发送,将邮件放到队列中,还没发送"; break; case MFMailComposeResultFailed: msg = @"用户试图保存或者发送邮件失败"; break; default: msg = @""; break; } //APP_ALERT_SHOW_TOP(msg); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"邮件提示" message:msg delegate:self cancelButtonTitle:@"我知道了" otherButtonTitles:nil,nil]; [alert show];}
0 0
- ios如何利用系统邮件发送邮件
- ios如何利用系统邮件发送反馈 代码
- iOS 调用系统发送邮件
- 利用oracle系统包UTL_SMTP发送邮件
- 如何利用sendmail发送外部邮件?
- iOS 调用系统短信、邮件发送界面
- 利用Web发送邮件
- 利用Jmail发送邮件
- 利用javascript发送邮件
- 利用线程发送邮件
- 利用java发送邮件
- 利用SmtpClient发送邮件
- 利用UTL_SMTP发送邮件
- 利用JAVAMAIL发送邮件
- 利用Spring 发送邮件
- 利用msmtp发送邮件
- 利用JavaMail发送邮件
- 利用winform发送邮件
- 处理对象的多种状态及其相互转换——状态模式(二)
- js处理字符串的substr()slice()substring()match()replace()用法
- iOS消息推送机制的实现
- 一句shell命令搞定代码行数统计
- 字典树
- ios如何利用系统邮件发送邮件
- 处理对象的多种状态及其相互转换——状态模式(一)
- 爱贝云计费API接口列表
- 使用支付宝支付的操作步骤
- HP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcache.so' -undefined symbol: z
- 计算脚本运行时间(简易)
- 经验随笔objective-C
- linux下C编程(四)之*p++=*q++
- Android开发:shape和selector和layer-list的(常用说明)