zoukankan      html  css  js  c++  java
  • ios发电子邮件

    ios发电子邮件

    by 吴雪莹


    第一:

    NSString *myEmail = @"3423423423@qq.com";
    NSString *toemail = @"asdfasdf@gmail.com";
    NSString *emailDetail = [NSString stringWithFormat:@"mailto:%@?

    cc=%@&subject=Feedback!&body=Dear:",toemail,myEmail]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: emailDetail]];


    另外一种:

    - (void)displayMailPicker {
        MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
        mailPicker.mailComposeDelegate = self;
        [mailPicker setSubject: @"Feedback!"];
        NSArray *toRecipients = [NSArray arrayWithObject: @"3434234@qq.com"];
        [mailPicker setToRecipients: toRecipients];
        NSArray *ccRecipients = [NSArray arrayWithObjects:@"asdfa@gmail.com", nil];
        [mailPicker setCcRecipients:ccRecipients];
        
        // add a picture
        UIImage *addPic = [UIImage imageNamed: @"icon_logo@2x.png"];
        NSData *imageData = UIImagePNGRepresentation(addPic);
        [mailPicker addAttachmentData: imageData mimeType: @"" fileName: @"Icon.png"];
        
        NSString *emailBody = @"<font size='4'>Dear:</font>";
        [mailPicker setMessageBody:emailBody isHTML:YES];
        [self presentViewController:mailPicker animated:YES completion:nil];
    }
    
    - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
        [self dismissViewControllerAnimated:YES completion:nil];
    }

    另一种普遍使用

    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    Python 遍历文件 读取文件夹里面的所有文件
    生活 帝国霸略 辅助工具的实现
    生活 帝国霸略 更换账户登陆 电脑登陆iphone手机账户 电脑手机同步登陆
    Python 颜色检测
    Python 指定窗口截屏
    Python 图片裁剪
    Python 窗口查找
    ES5新增的数组方法
    ES5对象新增的方法
    谈谈对文档碎片的理解
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4853774.html
Copyright © 2011-2022 走看看