New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gmail-node-mailer

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmail-node-mailer - npm Package Compare versions

Comparing version 1.0.55 to 1.0.56

2

dist/initializeClient.d.ts

@@ -5,2 +5,2 @@ export declare function initializeClient({ gmailServiceAccount, gmailServiceAccountPath, gmailSenderEmail, }?: {

gmailSenderEmail?: string;
}): Promise<import("googleapis").gmail_v1.Gmail>;
}): Promise<import("googleapis").gmail_v1.Gmail | null>;

@@ -41,17 +41,22 @@ "use strict";

return __awaiter(this, arguments, void 0, function* ({ gmailServiceAccount = process.env.GMAIL_SERVICE_ACCOUNT, gmailServiceAccountPath = process.env.GMAIL_SERVICE_ACCOUNT_PATH, gmailSenderEmail = process.env.GMAIL_USER, } = {}) {
// If the direct service account data is not provided, try loading from the provided path
if (!gmailServiceAccount && gmailServiceAccountPath) {
const absolutePath = path.resolve(gmailServiceAccountPath);
gmailServiceAccount = JSON.parse((0, fs_1.readFileSync)(absolutePath, 'utf-8'));
try {
// If the direct service account data is not provided, try loading from the provided path
if (!gmailServiceAccount && gmailServiceAccountPath) {
const absolutePath = path.resolve(gmailServiceAccountPath);
gmailServiceAccount = JSON.parse((0, fs_1.readFileSync)(absolutePath, 'utf-8'));
}
else if (!gmailServiceAccount && !gmailServiceAccountPath) {
throw new Error("Gmail service account data or path to the JSON file must be provided.");
}
const jwtClient = new googleapis_1.google.auth.JWT(gmailServiceAccount.client_email, undefined, gmailServiceAccount.private_key, ['https://www.googleapis.com/auth/gmail.send'], gmailSenderEmail);
yield jwtClient.authorize();
console.log('[/email/initializeEmailClient] - Gmail API client initialized successfully.');
const gmail = googleapis_1.google.gmail({ version: 'v1', auth: jwtClient });
return gmail;
}
else if (!gmailServiceAccount && !gmailServiceAccountPath) {
throw new Error("Gmail service account data or path to the JSON file must be provided.");
catch (error) {
return null;
}
const jwtClient = new googleapis_1.google.auth.JWT(gmailServiceAccount.client_email, undefined, gmailServiceAccount.private_key, ['https://www.googleapis.com/auth/gmail.send'], gmailSenderEmail);
yield jwtClient.authorize();
console.log('[/email/initializeEmailClient] - Gmail API client initialized successfully.');
const gmail = googleapis_1.google.gmail({ version: 'v1', auth: jwtClient });
return gmail;
});
}
exports.initializeClient = initializeClient;
{
"name": "gmail-node-mailer",
"version": "1.0.55",
"version": "1.0.56",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -7,3 +7,3 @@ import { google } from 'googleapis';

gmailServiceAccount = process.env.GMAIL_SERVICE_ACCOUNT,
gmailServiceAccountPath =process.env.GMAIL_SERVICE_ACCOUNT_PATH,
gmailServiceAccountPath = process.env.GMAIL_SERVICE_ACCOUNT_PATH,
gmailSenderEmail = process.env.GMAIL_USER,

@@ -15,23 +15,27 @@ }: {

} = {}) {
// If the direct service account data is not provided, try loading from the provided path
if (!gmailServiceAccount && gmailServiceAccountPath) {
const absolutePath = path.resolve(gmailServiceAccountPath);
gmailServiceAccount = JSON.parse(readFileSync(absolutePath, 'utf-8'));
} else if (!gmailServiceAccount && !gmailServiceAccountPath) {
throw new Error("Gmail service account data or path to the JSON file must be provided.");
}
try {
// If the direct service account data is not provided, try loading from the provided path
if (!gmailServiceAccount && gmailServiceAccountPath) {
const absolutePath = path.resolve(gmailServiceAccountPath);
gmailServiceAccount = JSON.parse(readFileSync(absolutePath, 'utf-8'));
} else if (!gmailServiceAccount && !gmailServiceAccountPath) {
throw new Error("Gmail service account data or path to the JSON file must be provided.");
}
const jwtClient = new google.auth.JWT(
gmailServiceAccount.client_email,
undefined,
gmailServiceAccount.private_key,
['https://www.googleapis.com/auth/gmail.send'],
gmailSenderEmail,
);
const jwtClient = new google.auth.JWT(
gmailServiceAccount.client_email,
undefined,
gmailServiceAccount.private_key,
['https://www.googleapis.com/auth/gmail.send'],
gmailSenderEmail,
);
await jwtClient.authorize();
console.log('[/email/initializeEmailClient] - Gmail API client initialized successfully.');
await jwtClient.authorize();
console.log('[/email/initializeEmailClient] - Gmail API client initialized successfully.');
const gmail = google.gmail({ version: 'v1', auth: jwtClient });
return gmail;
const gmail = google.gmail({ version: 'v1', auth: jwtClient });
return gmail;
} catch (error: any) {
return null;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc