Script I use for sending personalized bulk email.
- Do
cp .env.example .env
. After that fill in your secrets to.env
- Do
cp template/template.js.example template/teamplate.js
. Modify this copied file to your liking. Theparams
argument contains a map of the column values for the current row. - Run
npm start [input file path]
, where the input file is a CSV file with the first row containing the name of the column.
csv file named data.csv in the repository root:
name,email,greeting
Bob,[email protected],this is obviously a test.
Bob2,[email protected],this is serious shit mate.
- Set up the template file:
export default params => ({
from: '[email protected]',
to: '${params.email}',
subject: `Greetings, ${params.name}`,
text: `Hello
${params.greeting}
regards,
Secret Person
`,
})
- Run
yarn start data.csv