GitXplorerGitXplorer
f

email-automation

public
0 stars
0 forks
4 issues

Commits

List of commits on branch main.
Verified
a95cc367976ea613f1cebb120831a110e54b063f

fix(deps): update dependency mongodb to v6.12.0 (#175)

rrenovate[bot] committed 9 days ago
Verified
96932b93ed5768b63a413bf217901eec55eeddfa

chore(deps): update dependency typescript to v5.7.3 (#177)

rrenovate[bot] committed 9 days ago
Verified
723c9a518a40fa5046ac3abaded121fa1cf5a81b

chore(deps): update dependency @types/node to v18.19.70 (#176)

rrenovate[bot] committed 11 days ago
Verified
f01ef4517ae626f4b3513192e38ab59570149c2d

chore(deps): update dependency @types/node to v18.19.67 (#173)

rrenovate[bot] committed a month ago
Verified
e8e0f1b4e50b991a9cbda8bc4ab17a175819114a

fix(deps): update dependency dotenv to v16.4.7 (#174)

rrenovate[bot] committed a month ago
Verified
009bdb77b543aa04fa3db275e48719f8d36527a7

chore(deps): update dependency typescript to v5.7.2 (#171)

rrenovate[bot] committed 2 months ago

README

The README file for this repository.

Email Automation

This handles spinning up the droplets, managing the files, and tearing down the droplets with simple command line scripts. The idea is to make it less error-prone and tedious to prepare an email blast.

Requirements

  • You will need to have the 1Password CLI installed.
  • You will need to configure the environment variables. Ensure they are loaded into your 1Password - update the references in prod.env and mongo.env accordingly.
  • You will need to have the DigitalOcean CLI installed.
  • You will need to auth the doctl CLI, setting the --context to fcc (the commands rely on this auth context name.)
  • You will need an SSH key available in your DigitalOcean account.
  • You will need the AWS CLI, which you should authenticate with SSO. Name the profile freeCodeCamp for this tool to work correctly.

Dependencies

Usage

You'll need to start by configuring the environment variables for the email blast servers themselves. Copy the mongo.env from the templates directory to the data directory and fill in the values. Add an emailBody.txt file to the data directory and fill in the email body.

Getting the Email List

Spin up the DB droplet

To run the database query, you'll first need a droplet to do so. Typically you want to run the DB query the day before the blast, to avoid delaying your send. Run pnpm db:setup to spin up the droplet.

Prepare the DB droplet

Running pnpm db:files will load the necessary files to the query droplet, and give you instructions for running the query.

Teardown the DB droplet

Once the database query is complete, run pnpm db:teardown to download the email list and automatically destroy the droplet to save costs.

Running the Blast

Spin up the droplets

Run pnpm emails:setup to spin up new droplets. The script will automatically grant access to the configured ssh key, and assign the droplets to the configured project.

Initialise the files

Run pnpm emails:files to initialise the files on the droplets. This will copy the emails.env and emailBody.txt files to the droplets. This will pull down the full email list from the query, and batch it into files of equivalent size (or as close as it can), one for each droplet. It will push the email lists up to each droplet. Then you can ssh into each droplet and start the sending process.

Clean up

When the blast is complete, run pnpm emails:teardown to destroy the droplets, and pnpm scripts:clean to remove your sensitive local files. This minimises the risk that private data may be exposed.

Blocking Accounts

When a spam report for our email blast comes back through AWS, you need to prevent further emails to that address. Run pnpm scripts:block <email> to add the account to the suppression list and unsubscribe them from the newsletter in the database.