无法用邮件发送csv文件附件 [英] Can't sent csv file attachment with mail

查看:161
本文介绍了无法用邮件发送csv文件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MFMailComposeViewController发送生成的报告(csv)。

I have used the MFMailComposeViewController to send the generated report(csv).

现在邮件发送到收件人:电子邮件ID,&但当我检查邮件时,我确实收到了邮件但附件不在那里。

Now mail is sent to To:email id, & but when i checked the mails i did received the mail but attachment was not there.

然后我也尝试了MailComposer示例:

Then I also tried MailComposer example :

https://developer.apple.com/iphone/ library / samplecode / MailComposer / index.html

其中png图像附加到邮件演示。我也使用该应用程序发送邮件,但是没有提供相同的结果图像附件。

in which the png image is attached to mail demo. I also sent mail using that app, But same result image attachment is not delivered.

帮助,找出问题所在?
提前致谢。

Help, to find what's the problem? Thanks in advance.

以下是该应用中的代码:

Here is code in that app :

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];


// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"]; 

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];  
[picker setBccRecipients:bccRecipients];

// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"rainy"];

// Fill out the email body text
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];
[picker release];


推荐答案

在我的情况下,我的iPhone发送的邮件很好,但从我妻子的iPhone发送时没有附件。事实证明,她的默认帐户设置为她的雅虎帐户,并且不允许附件。我只是将其切换到她的移动我帐户并附件已经完成。我使用gmail所以我从来没有遇到过问题。

In my situation the email was sent fine from my iPhone, but there was no attachment when sending from my wife's iPhone. Turns out that her default account was set to her Yahoo account and that was not allowing attachments. I simply switched it to her mobile Me account and the attachment was made. I use gmail so I never had a problem.

此外,我曾尝试将MIME类型从text / csv切换到text / plain,但没有帮助。它可以在我的iPhone上运行,而不是在我妻子身上。

in addition, I had tried switching the MIME type from text/csv to text/plain and that did not help. It worked either way on my iPhone and not at all on my wife's.

希望这有帮助!

这篇关于无法用邮件发送csv文件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆