【问题标题】:MFMailComposeViewController adds null Content-IdMFMailComposeViewController 添加 null Content-Id
【发布时间】:2011-11-30 13:16:21
【问题描述】:

这是我在小组的第一篇文章,所以请善待:)

我正在从我的应用发送几个音频附件,如下所示:

 MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
 picker.mailComposeDelegate = self;
 picker.modalPresentationStyle = UIModalPresentationCurrentContext;
 [picker setSubject:@"Test message"]; 
 NSArray *toRecipients = [NSArray arrayWithObject:@"foo@bar.com"];
 [picker setToRecipients:toRecipients];

 // multiple attachments are made as follows
  NSData *myData = [NSData dataWithContentsOfFile:filePath];
 [picker addAttachmentData:myData mimeType:@"audio/x-caf" fileName:fileName];

 [picker setMessageBody:@"test message" isHTML:NO];

 [controller presentModalViewController:picker animated:YES];

mailComposeController 方法负责关闭模式视图。

不幸的是,当邮件被传递时,附件的 mime 标头着陆时 Content-Id 设置为 null。这是它的样子:

 Content-Type: audio/x-caf; name="audio_1.caf"
 Content-Transfer-Encoding: base64
 Content-Id: <(null)>
 Content-Disposition: attachment; filename="audio_1.caf"

如果我手动删除 Content-Id 字段并在我的 Mac 邮件程序(邮件版本 3.6)中重新加载邮件,附件会正确显示。换句话说,我真的不需要/不希望将 Content-Id 插入到 mime 标头中。

此外,值得一提的是,出于调试目的,如果我将 mime 类型设置为“image/jpeg”,则 mime 标头确实会获得有效的 Content-Id 字符串。我所有的附件都显示在邮件中。不出所料,在这种情况下,附件无法在 Mac 或 iPhone 上正确打开。

任何帮助将不胜感激。

谢谢, 阿普尔瓦

【问题讨论】:

    标签: iphone


    【解决方案1】:

    根据这篇文章,你不能手动设置Content-ID

    How to add a UIImage in MailComposer Sheet of MFMailComposeViewController

    【讨论】:

      【解决方案2】:

      好的。想通了——更多的是偶然。

      空内容 id 似乎是由邮件服务器(不是我的应用程序或 MFMailComposeViewController)插入的。

      最初我使用个人雅虎帐户测试发送。那是我遇到问题的时候。当我切换到我的工作帐户时,问题就消失了。

      谢谢, 阿普尔瓦

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-22
        • 1970-01-01
        • 2014-03-09
        • 2012-05-14
        • 1970-01-01
        • 2013-01-20
        相关资源
        最近更新 更多