pymail/README.md

47 lines
1.2 KiB
Markdown
Raw Normal View History

2020-12-07 15:01:09 +01:00
# pymail
Easily send mails via SMTP and python
2023-09-29 20:21:09 +02:00
## Installation
To install the requirements, run the following command
```
python -m pip install -r requirements.txt
```
## Usage
### Setup
2020-12-07 15:01:09 +01:00
1. Copy `vars.py.example` to `vars.py`
2022-10-09 19:14:16 +02:00
2. Setup `vars.py` with your credentials and config
2023-09-29 20:21:09 +02:00
3. Adapt `message.html` and save your contact list to `contacts.csv`
2020-12-07 15:01:09 +01:00
2023-09-29 20:21:09 +02:00
### Send mail
Just run
```sh
python mail.py
```
## Templating
2023-09-29 20:21:09 +02:00
You can use the keys from your `csv` directly, prepending a `$` sign (case sensitive!). For example:
```
Hello $name, your value is $value!
```
would look like the following:
```
Hello h4xx0r, your value is 1337!
2022-10-09 19:17:19 +02:00
```
With a `contacts.csv` looking like:
| name | value |
|--------|-------|
2023-09-29 20:21:09 +02:00
| h4xx0r | 1337 |
## Options
### Sending behavior
Some mail servers will block the requests, if too many are sent too fast. You can use the variables to add delays:
- `WAIT_EVERY` the amount of mails sent at once
- `DELAY_SEC` the amount of seconds to wait between sending the next batch
### Other options
- `LOGLEVEL` the logging level, set to `'DEBUG'` for most output
- `DRY_RUN` if set to `True`, the mails wont get sent, but the output is generated as if they would be sent. Good for testing and best to use with `LOGLEVEL = 'DEBUG'`