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 [email protected]!
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!!
-
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
- Option 1: click the green "Clone or download" button on the upper-right, then "Download ZIP"
-
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:
- Turn Allow less secure apps to ON for your gmail account.
-
Option 1: Use Docker (RECOMMENDED)
-
Shoutout to darrylbalderas for setting this up!
-
Install docker-engine
- Mac or Windows (Catalina, Mojave, or High Sierra; Windows 10 Pro, Enterprise, or Education)
- For older Mac and Windows systems install Docker Toolbox
- Linux
- Mac or Windows (Catalina, Mojave, or High Sierra; Windows 10 Pro, Enterprise, or Education)
-
Run the command:
./exec-docker
- Make sure you're in the
activism-mailbot/
oractivism-mailbot-master/
directory- Use
cd activism-mailbot/
orcd ~/activism-mailbot/
orcd /path/to/activism-mailbot/
- Use
- If that doesn't work, then execute the following sequence of commands:
docker build -t activism-mailbot .
- Might need to remove the old container:
docker rm -f activism-mailbot
docker run --name activism-mailbot -d activism-mailbot
docker exec -it $(docker ps -aqf "name=activism-mailbot") /bin/bash
- Make sure you're in the
-
Run application:
python send.py
-
-
Option 2: Legacy Method
-
Mac Users: you can double-click the
install-osx-python3
file instead -
Windows Users: TBD
-
Mac Users: you may need to install certificates for SSL to work
- ⌘ + space, search for a file named "Install Certificates.command"
- double-click the resulting file
- Read more here
-
Run
python3 send.py
- Make sure you are in the
activism-mail-bot
directory - If you aren't, use the command
cd activism-mail-bot/
- Make sure you are in the
-
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
- Enter the number corresponding to the state/city/county of your choice
-
Enter the subject (title) of your emails.
- If blank, mailbot will randomly generate a spicy title for you
-
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
- Easiest way: edit the contents of
- If you want mailbot to write the emails, answer
-
Enter your full name
-
Enter your gmail
-
Enter your gmail password
- i'm not logging this anywhere or anything, feel free to look at my code if you're paranoid
- Please add more recipients!
- Use this Google Form or add to
recipients.py
and submit a pull request
- Use this Google Form or add to
- thank you for your time, we did some good work :^)
- activism++
- Please remember to switch
Allow less secure apps
to OFF.
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.
- Organizations:
- Petitions