A small nodejs block that enables you to send emails via sendgrid (sendgrid account needed but its FREE)
-
clone the project
🔥and there you go. You're done. 🤣 just joking! What do you think i am ??? GOOGLE ?
there's still a bit of stuff to be done lol
-
cd into the project
-
rename you sendgrid.env.example to sendgrid.env
(this is just so that when you push to your github, the gitignore file i provided will not push the sendgrid.env file)
-
then go get your access token on sendgrid
(usually `SETTINGS > API KEYS` > you can handle the rest 💪🏼 I know you can 😏)
-
when you have your api access token, open the sendgrid.env file and paste it into the section where it says
"YOUR SENDGRID API KEY SHOULD COME HERE BETWEEN THESE TWO SINGLE QUOTES" 🤣🤣 lol
-
once you have that sorted out, then type into your terminal:
source ./sendgrid.env
this will make the variable SENDGRID_API_KEY global, so your little script can access it.
-
after that run:
npm install --save @sendgrid/mail
-
you will now need to go into the email.js file and go set some variables like
TO
andFROM
Those variables are obviously the email addresses you want to send TO and FROM
-
After that you're all good to go. 🔥 For real this time. just go into your terminal and run:
node email.js
-
TADAAAA 🤪 ** warning... THIS 10th step is not a step lol... ENJOY!!! 🔥💦