From e6ec8e7fbd7f3b124e24b96bdb655380f3ce452d Mon Sep 17 00:00:00 2001 From: nhsz Date: Tue, 14 Apr 2020 01:48:46 -0300 Subject: [PATCH] feat: use gmail service instead of smtp --- api/mail.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/mail.js b/api/mail.js index 1b31382..e8ce4e2 100644 --- a/api/mail.js +++ b/api/mail.js @@ -1,15 +1,16 @@ const nodemailer = require('nodemailer'); const paymentBodyTemplate = require('./utils/bodyTemplate'); -const { SMTP_HOST, SMTP_PORT, EMAIL_USER, EMAIL_PASS } = process.env; +const { EMAIL_USER, CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN } = process.env; const transport = nodemailer.createTransport({ - host: SMTP_HOST, - port: SMTP_PORT, - secure: true, + service: 'gmail', auth: { + type: 'OAuth2', user: EMAIL_USER, - pass: EMAIL_PASS + clientId: CLIENT_ID, + clientSecret: CLIENT_SECRET, + refreshToken: REFRESH_TOKEN } });