Playing with Ruby's Gmail gem

This program is composed in two parts

  1. Scrapping tool
  2. Mail bot

Scrapping tool

The scrapping tool get a french department as an input (i.e. between 01 and 95, including 971, 972, 973 and 974).

Then it returns a file "townhall.json" containing all the townhalls name and contact e-mail adress

It also saves the data in a spreadsheet

I decided to work with a json, as the execution speed is higher on my laptop

Mail bot

The mail bot asks you if you want to send a predifinite email.

If you press Yes, then the bot will send the mail to the whole townhall of the selected department.

If you want to use the file, please update your spreadsheet key in the spreadsheet.rb script.

Please install the gem `email_address` as I use to check if the scrapped adress are valid<./p>

To do so, type gem install email_address in your terminal.

I also used the dotenv gem in order to hide my mail account keys. I also advise you to create a .env file in the folder with the following lines:

username ="your_username"

password ="your_password"

And do not forget to install the gem if you do not currently use it.

How to use the program ?

Just launch send_emails.rb and follow the indications.

Have fun spamming France's townhall :)