2010-06-23 21 views
0

這是我的第一篇到組,所以請善待:)MFMailComposeViewController增加空的Content-Id

我送一對夫婦的音頻附件,從我的應用程序如下:

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
picker.mailComposeDelegate = self; 
picker.modalPresentationStyle = UIModalPresentationCurrentContext; 
[picker setSubject:@"Test message"]; 
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
[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被設置爲空。這裏是什麼樣子:

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

如果我手動刪除內容ID字段,在我的Mac郵件程序(郵件3.6版)的附件正確顯示加載消息。換句話說,我並不需要/希望將內容Id插入到MIME頭文件中。

另外值得一提的是,出於調試的目的,如果我將MIME類型設置爲「image/jpeg」,MIME頭文件將獲得有效的Content-Id字符串。我的所有附件都顯示在Mail中。正如預料的那樣,在這種情況下,附件在Mac或iPhone上無法正常打開。

任何幫助將不勝感激。

感謝, apurva

回答

0

確定。想通了 - 比其他事情更多的是偶然。

空內容ID似乎被郵件服務器(不是我的應用程序或MFMailComposeViewController)插入。

最初我正在測試發送個人雅虎帳戶。那是當我遇到問題。當我切換到我的工作帳戶時,問題消失了。

謝謝, apurva