A Node.Js script to send personalized emails with attachments to a group of emails. It works asynchronously, meaning it won't wait for the email to be sent but continues to render the next email and later check for callbacks.
- Clone this repo
- Run
npm install
- Create a file
creds.js
and input the following code into it:module.exports = { email: 'YOUR_GMAIL_EMAIL_ID', password: 'GMAIL_PASSWORD' //If two step verification enabled, generate a app password and replace here. }
- Give a listing of users in the users array in
index.js
. It must follow the following syntax:let users = [ { name: 'NAME', email: 'USER_EMAIL', filename: 'FILENAME_OF ATTACHMENT_IF_ANY', //Delete this and next line in case of no attachments path: 'path/to/file/with/extension', anyOtherParameters: 'Ex: ID Number etc...' } ]
- You can create templates in
templates
folder. updates
folder contains sample files. EditloadTemplate('updates', users)
to match your users and template folder name.- You can use extra handlebars denoted with
{{anyOtherParameters}}
to replace it while sending email. - Run the script using
node index.js
ornpm start