使用OAuth2和nodemailer从MY gmail帐户发送电子邮件 [英] send emails from MY gmail account with OAuth2 and nodemailer

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

问题描述

我想通过我自己的服务器从我的Gmail地址发送电子邮件。我正在使用nodemailer,并且使用帐户凭证不稳定,而且往往无法正常工作,并导致此



但是我如何获取访问令牌无需任何浏览器交互?



我似乎在这里错过了一些微不足道的东西......



我已经浏览了所有关于OAuth2,令牌和API的Google教程和文档,但所有的指南都会通过浏览器。

解决方案

转至 OAuth Playground ,点击右上角的cog,选中使用您自己的OAuth凭证并插入您的 clientID code>和 clientSecret

然后选择 Gmail API v1 code>范围你想要在左边的列表中,并按照概述的步骤,你会得到一个 access_token 和一个 refresh_token


I want to send emails from my gmail address through my own server. I'm using nodemailer and using account credentials is flaky, and often times doesn't work and leads to this thread

I've implemented everything on that thread many times, and still it's flaky, and also I know OAuth2 is the way to go.

I have a project with cliendID and clientSecret in google developer console, as you can see:

But how do I get an access token WITHOUT any browser interaction?

I seem to be missing something trivial here ...

I've went through all google tutorials and docs I could find about OAuth2, tokens, and APIs, but all guides go through the browser in one point.

解决方案

Go to the OAuth Playground, click the cog on the top right, check the Use your own OAuth credentials and insert your clientID and clientSecret.

Then select the Gmail API v1 scopes you want in the list to the left and follow the outlined steps and you will get an access_token and a refresh_token.

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

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