2
我一直在嘗試使用MFMailComposer來發送帶有加密數據的文本文件。問題是,當電子郵件到達收件箱時,我的附件永遠不會顯示出來。相反,一行「<br/><br/>
」始終存在。我假設是有關的MIME類型和接收郵件服務器不知道如何讀取數據,但我無法找出解決方案。在iPhone SDK中使用MFMailComposer附加純文本文件
任何人都遇到過這個,並有一個解決方案?
if([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate =self;
[mailController setSubject:@"Records"];
[mailController setMessageBody:@"" isHTML:YES];
[mailController addAttachmentData:dataToBeEncrypted mimeType:@"text/plain" fileName:@"Records.txt"];
[self presentModalViewController:mailController animated:YES];
[mailController release];
} else {
//Pop up a notification
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not send email. Verify Internet conneciton and try again." delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:nil];
[alert show];
[alert release];
}
感謝您給予的任何幫助!