电子邮件附件在Android中并不成功 [英] email attachment not successful in android

查看:119
本文介绍了电子邮件附件在Android中并不成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑下面的code:

String outFileName = "/data/data/com.packagename/attachment.ics";

emailintent.putExtra(Intent.EXTRA_STREAM, Uri.parse(outFileName));
        emailintent.setType("plain/text");
        startActivity(Intent.createChooser(emailintent, "Send mail..."));

以上code开始用它启动时显示的附件的电子邮件客户端。但是,当我发送电子邮件,附件没有收到。主体被接收。
到底是怎么回事错在这里?

The above code is starting the email client with the attachment shown when it starts. But when i send the email, the attachment is not received. The body is being received. what is going wrong here?

感谢您提前。

编辑:
是否有我需要把对ICS文件特定的MIME类型?我甚至试图发送一个txt文件,但同样不被发送。附件不显示当我试图发送电子邮件,但是当我收到的电子邮件未出现

Is there a specific mime type that i need to put for ics files? i even tried sending a txt file, but that too is not being sent. The attachment does show up when i am trying to send the email, but it does not appear when i receive the email

推荐答案

我发现,正在发生的问题。我把,我要附加到电子邮件到我的应用程序中的私人文件夹中的文件。邮件客户端无法访问。

i found the problem that was occurring. I was putting the file that i want to attach to the email into a private folder inside my application. The email client was not able to access..

所有我需要做的就是把它放在一个公共目录上的SD卡,瞧..电子邮件客户端访问了,我开始接受在我从我的应用程序发送的邮件。

All i had to do was put it in a public directory on the sdcard and voila.. the email client got access and i started receiving in the mails i sent from my application.

PS:即使ICS文件的MIME类型是纯/文

PS: Even for ics files the MIME type is plain/text.

感谢您的帮助。

这篇关于电子邮件附件在Android中并不成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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