Skip to content

Instantly share code, notes, and snippets.

@KritikaSharmaKS
Created November 23, 2020 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KritikaSharmaKS/91b4abbffdc4ecb45c93c5c87a7c8b7b to your computer and use it in GitHub Desktop.
Save KritikaSharmaKS/91b4abbffdc4ecb45c93c5c87a7c8b7b to your computer and use it in GitHub Desktop.
Send Emails from within your Node.js Application Using Nodemailer and SendGrid
const nodemailer = require('nodemailer');
const sendgridTransport = require('nodemailer-sendgrid-transport');
const transport = nodemailer.createTransport(sendgridTransport({
auth: {
api_key: 'paste-your-api-key-here'
}
}))
transport.sendMail({
to: 'theimmigrantprogrammers@gmail.com',
from: 'yourverifiedsendgridemail@gmail.com',
subject: 'Test Email',
html: '<h2>Please Like Share Comment And Subscribe</h2>'
})
.then(console.log('Success!'))
.catch(err => console.log(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment