This is an example of how to send an email. To run this script you should:
- Download the index.js and package.json files
- Install the dependencies with
npm install
- Get a SendGrid API key from your SendGrid dashboard
- Verify an email address or authenticate a domain so that you can send emails with SendGrid
- Set the credentials and other variables in the environment and run the script:
SENDGRID_API_KEY=xyz789 \
FROM_EMAIL=my_verified_email@domain.com \
TO_EMAIL=myemail@provider.com \
node index.js
Alternatively, you can replace the calls to process.env
with your variables.
Run the script and you will receive an email.