Python package for automated mail sending
Before building, you need to have setuptools and wheel installed:
python -m pip install --upgrade setuptools wheel
Then build the package and install the distribution. For the second command, change the version accordingly
python setup.py bdist_wheel && python -m pip install dist/sendmail-1.0.0-py3-none-any.whl
python -m pip install sendmail
python -m sendmail --config=template.yml --service=aws
- sender:
name: HMIF Tech
email: [email protected]
specs:
- template: TestTemplate
recipient_data: file.csv
Variable | Description |
---|---|
sender |
sender object |
sender.name |
The name of the sender shown in the email |
sender.email |
The email for sending |
specs |
List of spec object |
spec.template |
The name of the template used for the email |
spec.recipient_data |
path to a csv file containing recipient data (email, and variables to replace in the template file) |
Hello {{ fullName }}! Your verdict is: {{ verdictStatus }}
The first row of the csv file must contain all variables required in the template, otherwise TemplateAndCSVNotMatchException
will be raised.
It also must contain email
column, otherwise EmailHeaderNotFoundException
will be raised.
The email
column is used as the recipient's address.
email,fullName,verdictStatus
[email protected],Test Recipient,success
[email protected],Test Recipient 2,failed
The following email would be sent to [email protected]
from [email protected]
Hello Test Recipient! Your verdict is: success
python -m sendmail --mode=create_template --service=aws --template-name=TemplateName --subject=Subject --txt=PathToTextFile --html=PathToHTMLFile
Variable | |
---|---|
template-name |
Required |
subject |
Required |
txt |
Optional |
html |
Optional |