![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gmail-nodemailer-transport
Advanced tools
Gmail API and Nodemailer v4+. The plugin uses send scope only
The custom transport plugin that allows to send email using Nodemailer via Gmail
With the help of the Gmail API it is possible to use the send scope and Nodemailer v4+. The plugin is very small, optimized and written in TypeScript
If you like to use this module please click the star button - it is very motivating.
Install gmail-nodemailer-transport using npm:
$ npm install gmail-nodemailer-transport --save
Nodemailer common fields are supported and replyTo
send the simple email by the access token
'use strict';
const nodemailer = require('nodemailer');
const GmailTransport = require('gmail-nodemailer-transport');
let transporter = nodemailer.createTransport(new GmailTransport({
userId: 'my-address@gmail.com',
auth: {
accessToken: 'ya29.Glv5BvE5y-access-token'
}
}));
transporter.sendMail({
from: 'email@gmail.com',
to: 'recipient@test.com',
replyTo: 'reply-to@example.com',
subject: 'Gmail Transport',
text: 'This is text content'
}).then((info) => {
console.log('SUCCESS');
}).catch((error) => {
console.log('Something is wrong');
});
send the simple email, if it's failed to refresh the access token
'use strict';
const nodemailer = require('nodemailer');
const GmailTransport = require('gmail-nodemailer-transport');
let transporter = nodemailer.createTransport(new GmailTransport({
userId: 'my-address@gmail.com',
auth: {
clientId: 'clien-id.apps.googleusercontent.com',
clientSecret: 'clint-secret',
refreshToken: '1/EAATBaMn-refresh-token',
accessToken: 'ya29.Glv5BvE5y-access-token'
}
}));
transporter.sendMail({
from: 'email@gmail.com',
to: 'recipient@test.com',
replyTo: 'reply-to@example.com',
subject: 'Gmail Transport',
text: 'This is text content'
}).then((info) => {
console.log('SUCCESS');
}).catch((error) => {
console.log('Something is wrong');
});
send an attachment and embed it to the content
'use strict';
const nodemailer = require('nodemailer');
const GmailTransport = require('gmail-nodemailer-transport');
let transporter = nodemailer.createTransport(new GmailTransport({
userId: 'my-address@gmail.com',
auth: {
accessToken: 'ya29.Glv5BvE5y-access-token'
}
}));
transporter.sendMail({
from: 'email@example.com',
to: 'recipient@test.com',
replyTo: 'reply-to@example.com',
subject: 'Gmail Transport',
html: '<!DOCTYPE html><html><body><img src="cid:attachment" alt="attachment"></body></html>',
attachments: [{
content: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAA...', // base64 content
cid: 'attachment',
contentType: 'image/jpeg',
filename: 'attachment.jpg',
encoding: 'base64'
}]
}).then((info) => {
console.log('SUCCESS');
}).catch((error) => {
console.log('Something is wrong');
});
FAQs
Gmail API and Nodemailer v4+. The plugin uses send scope only
The npm package gmail-nodemailer-transport receives a total of 17 weekly downloads. As such, gmail-nodemailer-transport popularity was classified as not popular.
We found that gmail-nodemailer-transport demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.