-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up the Email Sender Module
-
Install dependencies:
pip3 install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
-
Follow Google's Gmail API official documentation to Turn on/Enable the Gmail API for your account. You'll need to create a project (or use an existing one), enable the Gmail API for that project, and then create an Oauth client ID. Add the following scopes to the Gmail API: "Gmail API: ../auth/gmail.send Send email on your behalf". There are a lot of possible scopes, but you only need this one. Since you're also just sending emails, feel free to use any google account, it doesn't have to read emails or interact in any other way.
-
Download and save the
credentials.json
file that the previous step creates to theconfig/
directory in this project. -
Update the desired receiver of the email in the config/settings.ini file. Example:
[emailsender] # recipient of email receiver = [email protected]
-
This project is not verified by Google, so the first time you run the email sender module, it will open a browser and ask you to sign in to the Gmail account where you enabled the Gmail API. It may pull up a screen as shown below where you'll have to click "Advanced" and proceed to allow the email sender module to send email on your behalf. To be clear, no information is being sent to the creators of this project, you are allowing the email sender module file on your computer to send an email on your behalf.
Tip: If you are running on an environment with no monitor or browser, you can run the email sender module once on a laptop/desktop and then copy the
config/email_token.pickle
file that gets created back over into your standard environment.
It's possible to run the email sender module by itself with:
python3 lib/email_sender.py