使用默认用户帐户以编程方式发送电子邮件 [英] sending email programmatically using default user account

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

问题描述

我希望能够根据用户在应用程序的活动上按下按钮来从我的应用程序中发送电子邮件。按下按钮后,应用程序需要自动发送电子邮件,也就是说,我不想向用户显示其他电子邮件表单。并且应该使用用户在电话上的默认电子邮件帐户 发送电子邮件 ,而不是我硬编码到应用中的电子邮件帐户。而且我不想将用户密钥的电子邮件凭据添加到我的应用程序的配置中,我只想能够调用一些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 don't 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 don't 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中发送电子邮件,而无需使用默认/内置应用程序

根据评论进行更新:

如果没有电子邮件,则无法无声发送电子邮件


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

  • 或在使用上述电子邮件API之前要求用户名和密码(用户将通过输入这些值来暗含地允许您批准发送/接收电子邮件)

那是非常好的事情!安全性让步太多否则。如果找到了方法,请将其作为错误报告发布到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天全站免登陆