Automates the mailing process for KOSS during various events like KWoC and selections.
Warning Always do a test run before using the scripts, there are many things which might go wrong and we can't afford sending broken/incorrect mails to the reciepients.
-
For the first time, you need to generate token for api.
-
Either use already available templates or create a new template with the conventions mentioned in about templates.
-
Make sure the the column names for
name
andemail
entries are one of those mentioned in variable_mappings.py. -
Make sure the files are stored in correct directory:
- Templates files must be stored in
./templates/
. - CSV files must be stored in
./csv/
,
Hence no need to mention them again while specifying the location, just specify the location after these default directories.
- Templates files must be stored in
-
Use the script according to your needs,
bcc.py
orone-to-one.py
. Both follow same method of executionpython3 script.py <template> <csv_file> (OPTIONAL)<variables with same value for all mails>
-
Use the
calendar-invite
script to mail a calendar invite for an event. Do not use templates with personalised variables for each email. Do not include a lobby link as it will be auto generated.python3 calendar-invite.py <template_file> <csv_file> <include_meet> <slot_time> (OPTIONAL)<variables_with_same_value_for_all_mails>
Here are one example for each case supported:
python3 one-to-one.py selections/onboarding onboarding.csv number_of_applicants="250+"
python3 one-to-one.py selections/task day1.csv deadline="Monday, 9 June 2023"
python3 bcc.py selections/rejection rejected.csv
python3 bcc.py selections/round1-interview-slot r1d1.csv slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM" lobby_link="https://meet.google.com/xxx-xxxx-xxx"
python3 bcc.py selections/round2-interview-slot r2d2.csv slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM" lobby_link="https://meet.google.com/xxx-xxxx-xxx"
python3 calendar-invite.py selections/onboarding onboarding.csv YES slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM"
python3 calendar-invite.py selections/onboarding onboarding.csv NO slot_time='Tuesday, 2 February 2030, 8:00 AM - 1:00 PM number_of_applicants='250+'
-
Follow the steps at Gmail API - Python Quickstart guide to get
credentials.json
.Note
credentials.json
is permanent until you delete it in your google clound console.
And make sure to add[email protected]
as a test user in case you made the app internal. -
Follow the steps below to generate
token.json
:-
Download gentokenjson.py in the same folder containing
credentials.json
-
Import the required module
pip install google-auth-oauthlib
-
Execute
gentokenjson.py
withsend
argumentpython3 gentokenjson.py send
-
Browser window will open and ask you to select the account, choose the one receiving OTP for login
-
Allow permission on that email to use just enabled GMAIL API
- Click on
Continue
instead of Back To Safety - Then press
Continue
again
- Click on
-
token.json
will be generated in same folder as that ofcredentials.json
Warning
token.json
expires after sometime. So make sure to check that in your projects and keep refreshing it. -