Created
November 23, 2020 03:29
-
-
Save KritikaSharmaKS/91b4abbffdc4ecb45c93c5c87a7c8b7b to your computer and use it in GitHub Desktop.
Send Emails from within your Node.js Application Using Nodemailer and SendGrid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '[email protected]', | |
from: '[email protected]', | |
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