The program searches for PDF files in a special naming format (group_name+attach1.....pdf) and sends them to different email addresses.
The addresses are loaded from a CSV file containing the group name and the email addresses.
The two spaces (also after the Firstname) are important, because they are referenced for the search. All stuff behind is not important. Only the .pdf extension.
Groupname additional Stuff .pdf
Examples:
Lastname Firstname xxxxxxxxxxxx xx x x.pdf
Smith Kaith bill.pdf
Gilles Tom Bill.pdf
Smith Kaith incoice.pdf
Smith Keith chocolate.pdf
Gilles Tom cake.pdf
Mueller Craig chocolate cake.pdf
- The difficult part is to create the Google MAIL API Json file according to the video Getting Started With Google APIs For Python Development from Jie Jenn. IMPORTANT: Activate Google Mail API
- Store the
client_secret.jsonfile (from the Video above) in the main folder - Rename and edit the
.env.examplefile to.envwith the appropriate values - Create and activate a venv and load the modules according to the
requirements.txtfile.
- Rename the
groups.csv.examplefile togroups.csvand fill in the working groups and emails. - Rename and edit the
mail.txt.examplefile tomail.txtand insert the html format body text.
Now you can start the program in the venv:
python3 sendEmail.pyThe program goes through the PDF directory, searches acording to the groups.csv and send the emails. After sending of each email the related PDF files are moved to the old directory.