Skip to content

Commit

Permalink
added new fields in the email options
Browse files Browse the repository at this point in the history
  • Loading branch information
beblicarl committed Nov 13, 2023
1 parent 9512ea0 commit db3a870
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/utilities/emailSender.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nodemailer = require("nodemailer");
const { google } = require("googleapis");
const logger = require("../startup/logger");
const nodemailer = require('nodemailer');
const { google } = require('googleapis');
const logger = require('../startup/logger');

const closure = () => {
const queue = [];
Expand All @@ -12,9 +12,9 @@ const closure = () => {
const REFRESH_TOKEN = process.env.REACT_APP_EMAIL_REFRESH_TOKEN;
// Create the email envelope (transport)
const transporter = nodemailer.createTransport({
service: "gmail",
service: 'gmail',
auth: {
type: "OAuth2",
type: 'OAuth2',
user: CLIENT_EMAIL,
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
Expand All @@ -24,7 +24,7 @@ const closure = () => {
const OAuth2Client = new google.auth.OAuth2(
CLIENT_ID,
CLIENT_SECRET,
REDIRECT_URI
REDIRECT_URI,
);

OAuth2Client.setCredentials({ refresh_token: REFRESH_TOKEN });
Expand All @@ -34,7 +34,9 @@ const closure = () => {

if (!nextItem) return;

const { recipient, subject, message, cc, bcc, replyTo } = nextItem;
const {
recipient, subject, message, cc, bcc, replyTo,
} = nextItem;

try {
// Generate the accessToken on the fly
Expand Down Expand Up @@ -69,7 +71,7 @@ const closure = () => {
message,
cc = null,
bcc = null,
replyTo = null
replyTo = null,
) {
if (process.env.sendEmail) {
queue.push({
Expand Down

0 comments on commit db3a870

Please sign in to comment.