alandgton / activism-mailbot

53 stars 14 forks source link
activism email email-sender emails python3 social-good

Activism Mailbot

In light of recent events, I have created this Python script to send emails to a list of 542 elected US officials.

The script sends a unique message to each lawmaker by varying sentence structures and switching out nouns, verbs, adverbs, and adjectives with synonyms. Each email is constructed to roughly follow the template from nomoreracistcops.github.io. Please report bugs to alandgton@gmail.com!

This script only works for gmail accounts.

NOTE: there is a per-minute limit on SMTP messages sent via google's servers. to appease our corporate overlords, i've decreased the speed of our operations.

If you're going to use this tool in one of your projects, I'm hoping that you'll have enough self-respect to give credit where it is due. Please do not monetize this script. Thanks!!

Setup

  1. Download the source code

    • Option 1: click the green "Clone or download" button on the upper-right, then "Download ZIP"
      • Then, decompress the files somewhere on your computer
    • Option 2: git clone https://github.com/alandgton/activism-mail-bot.git
      • Requires: a Github account, a terminal, and git installation
  2. Temporarily grant mailbot permission to send emails on your behalf

    • Turn Allow less secure apps to ON for your gmail account.
      • Be aware that this makes it easier for others to gain access to your account.
      • After running the script, you should switch this back OFF.
      • Your name, gmail, and password aren't being stored on a server anywhere, this script is run from your own computer!
    • If you have 2 Factor Authentication enabled on your gmail account:

Running the script

How to use mailbot

  1. Choose which officials you would like to send emails to

    • Enter the number corresponding to the state/city/county of your choice
      • Enter 0 to Select All (current total: 542 recipients)
    • Enter blank (nothing) when finished selecting
    • NOTE: some city councilmembers may ask for your address to confirm that you are their constituent
  2. Enter the subject (title) of your emails.

    • If blank, mailbot will randomly generate a spicy title for you
  3. Would you like to write your own email or have mailbot do it for you?

    • If you want mailbot to write the emails, answer y.
    • Else if you have your own email message, answer n.
      • Mailbot will now read from a .txt file
      • Please write your own email in a .txt file
        • Easiest way: edit the contents of example.txt
        • Tell mailbot the name of your .txt file
        • Example: example.txt
  4. Enter your full name

  5. Enter your gmail

  6. Enter your gmail password

    • i'm not logging this anywhere or anything, feel free to look at my code if you're paranoid

Final Steps

Footnote

This is a critical time for the rights and freedoms that we cherish as American citizens. Check out this compilation of activism resources and notes (credit: Jemma Kwak)!

Listed below are organizations gladly accepting donations and petitions to sign.