Socket
Socket
Sign inDemoInstall

@singtone/nodemailer-sendgrid-transport

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@singtone/nodemailer-sendgrid-transport

A nodemailer transport plugin sending email via SendGrid's V3 REST API; Support SendGrid options such as categories, tracking settings or send_at etc; Support http, https, socks4 or socks5 proxy.


Version published
Maintainers
1
Weekly downloads
1
Bundle size
7.7 kB
Minified + gzipped

Weekly downloads

Readme

Source

nodemailer-sendgrid-transport

This repository is a nodemailer transport plugin sending email via SendGrid's V3 REST API.
Support SendGrid options such as categories, tracking settings or send_at etc.
Support http, https, socks4 or socks5 proxy via proxy-agent.

dependencies

axios

Usage

Install via npm.

Support SendGrid options of categories, send_at, batch_id, asm, ip_pool_name, mail_settings, tracking_settings

var nodemailer = require('nodemailer');
var sgTransport = require('@singtone/nodemailer-sendgrid-transport');
var proxy = require('proxy-agent');  //optional

var options = {
	auth: {
		api_key: 'SENDGRID_APIKEY'
	},
    proxyAgent: proxy(process.env.PROXY)  //optional. i.e. https://myproxy.sample.com:8080
}

var mailer = nodemailer.createTransport(sgTransport(options));
var email = {
	to: ['john@foo.com', 'smith@bar.com'],
	from: 'david@baz.com',
	subject: 'Hello World',
	text: 'Awesome sauce',
	html: '<b>Awesome sauce</b>',
	attachments: {
		filename: 'text1.txt',
		content: 'aGVsbG8gd29ybGQh',
		encoding: 'base64'
	},
	sendGrid: {  //optional SendGrid Options
		"categories": [
			"cake",
			"pie",
			"baking"
		],
		"send_at": 1617260400,
		"tracking_settings": {
			"click_tracking": {
				"enable": true,
				"enable_text": false
			}
		}
	}
};

mailer.sendMail(email, function(err, res) {
	if (err) { 
		console.log(err) 
	}
	console.log(res);
});

FAQs

Last updated on 26 Sep 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc