发送电​​子邮件在Android中,而无需用户interacton [英] Send e-mail in Android without user interacton

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

问题描述

我想使用任何默认邮件提供商的用户已经设置为发送电子邮件我的应用程序。它必须能够以发送电子邮件,而无需任何用户交互。如果我能避免表现出任何的用户界面,这将是最好的解决方案。有一件事是不能接受的是,无论是硬code或要求用户输入他们的电子邮件证书。用户必须已经建立自己的账户,如Gmail与他们的凭据。我所有的应用程序不会是使用现有的电子邮件提供商已设置。

I would like to send an e-mail in my app using whatever default mail provider the user already has setup. It must be possible to send the e-mail without requiring any user interaction. If I can avoid showing any UI, that would be the best solution. The one thing that is unacceptable is to either hardcode or request the user enter their e-mail credentials. The user had to have already setup their account such as Gmail with their credentials. All my app does is use an existing e-mail provider that has been setup.

大多数我已经在这里发现了使用意图,但是从我的理解,这将显示电子邮件的用户界面和职位要求用户preSS发送按钮。

Most of the posts I have found here use an Intent but from what I understand, that will show the e-mail UI and requires the user to press the Send button.

推荐答案

在一些周围挖,我觉得有一个解决方案。谷歌现在已经使用OAuth 2.0,避免了需要访问的用户的用户名和密码,增加了对Gmail的认证。由于我的应用程序会要求用户拥有Gmail帐户,这可能是解决方案。当然,这不会对其他任何电子邮件提供商不支持OAuth的工作,但由于谷歌关注的是保护用户名/密码,这种做法似乎是正确的。需要考虑如何在我的应用程序使用OAuth的,但理论上应该是可能的。一旦一个用户授予权限谷歌的服务,应用程序接收用于许可仍然是,寿命的令牌。这仍然是尚未解决的问题是,Gmail的是否支持使用OAuth发送电子邮件:

After some more digging around, I think there is a solution. Google has now added support for Gmail authentication using OAuth 2.0 which avoids the need to access the user's username and password. Since my app will require the user to have a Gmail account, this might be the solution. Of course this won't work for any other e-mail provider that doesn't support OAuth but since Google is concerned about protecting username/passwords, this approach seems to be right. Need to look into how to use OAuth from within my app, but theoretically it should be possible. Once a user grants permission to a Google service, the app receives a token that is used for the lifetime that the permission remains. The question that is still unresolved is whether Gmail supports sending an e-mail using OAuth:

谷歌带来的OAuth 2.0支持到Gmail和谷歌谈为了使第三方应用程序更安全

OAuth2支持Gmail的

谷歌的样品code支持Gmail和OAuth2

Android应用程序演示了如何使用发送电子邮件的OAuth

YouTube的视频显示如何在移动应用程序使用2步骤验证在应用

上使用OAuth 2.0 Android的文档

Android docs on using OAuth 2.0

code样品使用发送电子邮件OAuth2

这篇关于发送电​​子邮件在Android中,而无需用户interacton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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