Tag: gmail

试图使用nodemailer使用Gmail发送电子邮件,并收到错误:“无法为用户创build新的访问令牌”

我目前有一个设置,使用gmamail中的nodemailer发送邮件。 当我手动创build一个访问令牌(它只持续〜1小时)时,它工作正常。 但是,过了一小时后,我得到了下面的错误。 请注意,在那个小时内,我能够发送电子邮件就好,一切正常。 { Error: Can't create new access token for user at XOAuth2.generateToken (C:\Users\user\My-Projects\***\node_modules\nodemailer\lib\xoauth2\index.js:162:33) at XOAuth2.getToken (C:\Users\user\My-Projects\***\node_modules\nodemailer\lib\xoauth2\index.js:111:18) at SMTPConnection._handleXOauth2Token (C:\Users\user\My-Projects\***\node_modules\nodemailer\lib\smtp-connection\index.js:1421:27) at Immediate.setImmediate (C:\Users\user\My-Projects\***\node_modules\nodemailer\lib\smtp-connection\index.js:1239:45) at runCallback (timers.js:666:20) at tryOnImmediate (timers.js:639:5) at processImmediate [as _immediateCallback] (timers.js:611:5) code: 'EAUTH', command: 'AUTH XOAUTH2' } 我用来发送电子邮件的代码是: var emailMsg = `Name: ${name}\nEmail: ${email}\n\nMessage:\n${msg}`; var transporter = nodemailer.createTransport({ service: 'gmail', […]

Node.js向Gmail API发送消息的POST请求

我正尝试使用服务器端node.js向Gmail Send Message API发送请求,但没有成功。 我收到以下错误: body: '{ "error": { "errors": [ { "domain": "global", "reason": "invalidArgument", "message": "\'raw\' RFC822 payload message string or uploading message via /upload/ URL required" } ], "code": 400, "message": "\'raw\' RFC822 payload message string or uploading message via /upload/ URL required" } }' } oauth2token和raw的input参数是有效的,事实上,如果我使用Google OAuth 2操场( https://developers.google.com/oauthplayground )并使用令牌和raw作为电子邮件发送的值。 有人可以看到我错过了什么吗? […]

带环回的Gmail的Nodemailer错误 – 对象#<对象>没有方法'getToken'

我正在学习Loopback,并决定发送一些电子邮件。 我想使用Gmail帐户。 我创build了远程方法和configuration数据源。 以下是它的外观: "myEmailDataSource": { "name": "myEmailDataSource", "connector": "mail", "transports": [ { "type": "smtp", "host": "smtp.gmail.com", "auth": { "xoauth2": { "user": "myMail@gmail.com", "clientId": "myClientId.apps.googleusercontent.com", "clientSecret": "mySecret", "refreshToken": "myToken" } } } ] } 但是,当我想发送一封电子邮件,它会引发这个错误: TypeError: Object #<Object> has no method 'getToken' at SMTPConnection._handleXOauth2Token (/home/arth95/Projects/firstCMS/node_modules/loopback/node_modules/nodemailer/node_modules/nodemailer-smtp-transport/node_modules/smtp-connection/src/smtp-connection.js:961:67) at SMTPConnection.login (/home/arth95/Projects/firstCMS/node_modules/loopback/node_modules/nodemailer/node_modules/nodemailer-smtp-transport/node_modules/smtp-connection/src/smtp-connection.js:233:18) at SMTPTransport.<anonymous> (/home/arth95/Projects/firstCMS/node_modules/loopback/node_modules/nodemailer/node_modules/nodemailer-smtp-transport/src/smtp-transport.js:96:24) at SMTPConnection.g (events.js:180:16) at […]

node.js Gmail API:获取embedded式/embedded式图像

抓取电子邮件时,运行gmail.users.messages.get() ,然后运行以下两个函数来处理payload 。 function getBody(message) { var encodedBody = ''; try{ if(typeof message.parts === 'undefined'){ encodedBody = message.body.data; } else{ encodedBody = getHTMLPart(message.parts); } encodedBody = encodedBody.replace(/-/g, '+').replace(/_/g, '/').replace(/\s/g, ''); } catch(e) {} // there was a failure return decodeURIComponent(escape(window.atob(encodedBody))); } function getHTMLPart(arr) { for(var x = 0; x <= arr.length; x++){ if(typeof arr[x].parts === […]

Nodemailer Gmail邮件副本

我正在使用nodemailer使用gmail发送电子邮件,电子邮件作为发送,但它存储在gmail帐户。 nodemailer上的任何参数禁用发送电子邮件上的存储副本?

通过G Suite电子邮件地址从服务器发送电子邮件

我正在尝试使用nodemailer从node.js服务器发送电子邮件 我目前有一个域名在Google Domains注册,而且我有一个G Suite实例设置为我提供了一个电子邮件服务器。 我有一个电子邮件设置: noreply@domainname.com 我试图做的是从我的服务器上面的电子邮件发送电子邮件。 我不想使用普通用户和密码validation,因为这对我来说是非常不安全的。 有没有人有一个教程或文件,他们可以连接我,这将帮助我实现这一目标?

使用node.js gmail api列出收件箱邮件

我已经做了这个演示,但是我不知道如何去列出我的收件箱中的实际消息。 我已经看过这里 ,但我不知道如何将它融入节点? 提前致谢! 对不起,如果这是公然的obvios。 最好, -Zoe

GmailAPI – Node.js – 无法更新用户签名

我已经通过gmail API授权了一个小型的节点应用程序。 我正在成功得到答复。 例如,我可以使用users.settings.sendAs.list()来查看我的电子邮件签名 但是,当我尝试更改设置,在这种情况下签名,我回来的回应是空的。 所以更新工作,我可以擦拭我手动添加在Gmail中的签名,但我不能添加任何新东西。 这是脚本 var google = require('googleapis'); var key = require('./Sig-Updater.json'); var gmail = google.gmail('v1'); var jwtClient = new google.auth.JWT( key.client_email, null, key.private_key, ['https://www.googleapis.com/auth/gmail.settings.basic', 'https://www.googleapis.com/auth/gmail.settings.sharing', 'https://www.googleapis.com/auth/gmail.modify', 'https://mail.google.com', 'https://www.googleapis.com/auth/gmail.compose', 'https://www.googleapis.com/auth/gmail.readonly' ], 'some_email@somewhere.com' ); jwtClient.authorize(function (err, tokens) { if (err) { console.log('Auth failed because: ' + err); return; } console.log(tokens) gmail.users.settings.sendAs.update({ userId: 'me', […]

Google API为批量请求返回400个BadRequest

我正尝试使用对nodejs的请求将请求发送到GMail API 。 问题是甚至槽我生成相同的查询,在文档中,gmail总是响应400的BadRequest 这些是我的JSONforms的标题 { 'Content-Type': 'multipart/mixed; boundary=c2db2692-8877-4159-bf02-03e6c5d3ffbf', authorization: 'Bearer MY_TOKEN', 'content-length': 231 } 正文内容示例 –c2db2692-8877-4159-bf02-03e6c5d3ffbf Content-Type: application/http Content-ID: <item1:12930812@barnyard.example.com> GET /gmail/v1/users/sneg0k32@gmail.com/messages/14c6c0c43e9bb16b –c2db2692-8877-4159-bf02-03e6c5d3ffbf– 任何build议为什么发生这种情况 请求生成额外的几个空格,并以小写字母,但我不知道这是否是问题。 nodejs代码示例 request({ method: 'POST', uri: 'https://www.googleapis.com/batch', auth: { bearer: key }, headers: { 'Content-Type': 'multipart/mixed' }, multipart: _.map(queries, function(query) { return { 'Content-Type': 'application/http', 'Content-ID': "<item1:12930812@barnyard.example.com>", body: 'GET ' […]

从Google API获取联系人列表,个人资料照片和电子邮件

关于“使用Googlelogin”的单个组件有几个问题,但是我找不到涉及当前API的任何内容(截至2015年7月)。 我有一个“在Gmaillogin”选项在我的Web应用程序,我想检索: 我曾发送和收到的所有电子邮件(如果可能的话) 我所有的联系人列表 所有我的联系人的个人资料图片(以及其他可能的信息,如地点,性别,年龄等)的列表 现在,在我的oAuthlogin中,我使用以下范围: ['profile', 'email','https://www.googleapis.com/auth/userinfo.profile', 'https://www.google.com/m8/feeds'] 然后,一旦我有我的oAuth令牌,我做了以下的API调用: https://www.google.com/m8/feeds/contacts/default/full?max-results=10000&alt=json&oauth_token={{token}} 这给我一个联系电子邮件和相关名称的列表,但没有图片(至less我可以find),没有其他有关联系人的信息。 我也想能够下载所有的用户发送/接收的电子邮件,我知道我必须通过IMAP来做到这一点,但我只能find需要用户名和密码的NodeJS实现。 是否有可能使用oAuth令牌? 理想情况下,我想用一个oAuth调用来完成这一切,因为我正在构build一个电子邮件分析工具。