使用默认用户帐户程序发送电子邮件 [英] sending email programatically using default user account

查看:151
本文介绍了使用默认用户帐户程序发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够根据用户按下我应用程序活动的按钮,从我的应用程序发送电子邮件。电子邮件需要按下按钮时由应用程序自动发送,即我不想向用户显示其他电子邮件表单。电子邮件应该使用手机上的用户默认电子邮件帐户 发送,而不是我硬编码到我的应用程序中的电子邮件帐户。而且我不想将他们的电子邮件凭证中的用户密钥存入我的应用程序的配置,我只想要调用一些android api,并说发送这个电子邮件与这个主题和正文到这个电子邮件地址,使用默认帐户用户已经在电话上设置了。

I want to be able to send an email out of my app, based on the user pressing a button on my app's Activity. The email needs to be sent automatically by the application upon button press, i.e. I dont want to show another email form to the user. And the email should be sent using the user's default email account on the phone not an email account that I hardcode into my app. And I dont want to have the user key in their email credentials into my app's configuration, I just want to be able to call some android api and say "send this email with this subject and body to this email address, using the default account that the user has set up on the phone".

这可能吗?如果是这样,怎么办?

Is this possible? If so, how?

提前感谢...

推荐答案

在后台发送,请查看相关问题列表右侧的第一个链接:

To send in the background, see the first link at your right on the list of related questions:

您需要使用电子邮件API(如JavaMail):

You need to use an email API such as JavaMail:

使用JavaMail API在Android中发送电子邮件,而不使用默认/内置应用

根据评论更新:

无法以的方式发送电子邮件:

There is no way to send an email silently, without either:


  • 让用户首先(通过使用意图和电子邮件提供商)知道并接受它

  • ,或者在使用电子邮件API之前询问用户名和密码(用户将隐含地给你批准通过输入这些值发送/接收电子邮件)

这是一个非常好的事情!否则有太多的安全问题。如果你找到方法,请把它作为一个bug报告在android。

And that is a very good thing! There are too many security concerns otherwise. If you ever find a way, please post it as a bug report in android.

这篇关于使用默认用户帐户程序发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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