如何使用的authToken发送电子邮件? [英] How can I use authToken to send email?

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

问题描述

不知怎的,我设法从谷歌 Android中获得的authToken。现在,我找不到我怎么能使用此标记使用的电子邮件ID和的authToken无需用户交互发送电子邮件。

Somehow I managed to get AuthToken from Google in Android. Now I can't find how could I use this token to send email using the email id and the authToken without user interaction.

请提供一些例子。

推荐答案

除非这在他们的标准形式使用密码验证使用SMTP或IMAP无法使用Gmail发送电子邮件编程。

You cannot send emails using Gmail programmatically unless you use SMTP or IMAP which in their standard form use password authentication.

然而,这是基于OAuth的(XAOUTH SASL),你可以用 SMTP AUTH 命令用于验证使用标准的3条腿的OAuth的Gmail服务器的Gmail实验性API 。有了这个,你应该得到一个短暂的令牌,可用于发送电子邮件。我没有试过在Android上,但我不明白为什么它不应该工作:

However, there is an experimental GMail API that's based on OAuth (XAOUTH SASL) which you can use with SMTP AUTH command to authenticate to Gmail servers using standard 3 legged OAuth. With this, you should get a short lived token that you can use for sending emails. I haven't tried this on Android but I don't see why it shouldn't work:

HTTP://$c$c.google.com/的API /的Gmail / OAuth的/ protocol.html

所以,你可以下载客户端库这个GMail的API非常久远Java邮件并给它一个试试吧!有捆绑的样本,你可以使用概念的快速证明。

So, you can download the client libraries for this GMail API alongwith Java Mail and give it a try! There is a sample bundled which you can use for a quick proof of concept.

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

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