Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rohitedathil/automailer

Utility to send emails using an HTML template by filling it with data from a CSV file.
https://github.com/rohitedathil/automailer

automation email jinja2 python smtp

Last synced: 19 days ago
JSON representation

Utility to send emails using an HTML template by filling it with data from a CSV file.

Awesome Lists containing this project

README

        

#

Automailer

Project by TEAM 1 for PROJECTARO conducted by CSI GECBH

## Team Members
- Rohit V
- Gokul Krishnan K P
- Amrita Jiju
- Anamika R S

Utility to send emails using an HTML template by filling it with data from a CSV file.

## Installation

- Clone the repo to a folder
- Create and activate virtual environment (Optional)
- Install dependencies by running

```
pip install -r requirements.txt
```

## Usage

---

### `config`

Configures the utility.

```
python ./app.py config
```

It will prompt you to Enter email and password.

**Only supports Gmail!!**
Make sure to [enable access](https://myaccount.google.com/lesssecureapps) to less secure apps in your Gmail account.

Credentials can be modified in `config.json` file. Which is generated by `config` command.

---

### `run`

Runs a specified job.

```
python ./app.py run JobName
```

This command checks for `template.html` and `data.csv` files in `jobs/JobName/`. And uses them as templates and data source respectively. Then sends the email after filling the template.

---

## Example

For reference, a sample job is available in the `jobs` directory called EventLink.

`jobs/EventLink/template.html`

```html


{{ event }}



Hello {{ name }},

Thank you for signing up for {{ event }}. We're really happy to have you!
Click the link below to login to your account:

Login


```

`jobs/EventLink/data.csv`

```
name,event,link,email,subject
Bob,IoT Workshop,#bob,[email protected],IoT Workshop Link
Alice,IoT Workshop,#alice,[email protected],IoT Workshop Link
Rick,IoT Workshop,#rick,[email protected],IoT Workshop Link
Sam,IoT Workshop,#sam,[email protected],IoT Workshop Link
Ted,IoT Workshop,#ted,[email protected],IoT Workshop Link
Dug,IoT Workshop,#dug,[email protected],IoT Workshop Link
Ken,IoT Workshop,#ken,[email protected],IoT Workshop Link

```

**Note: email and subject are mandatory fields**

The tool uses jinja2 to fill the template with data from the CSV file. So the template can be any HTML file. But it should use [jinja2 templating syntax ](https://jinja.palletsprojects.com/en/3.0.x/templates/)inorder to get expected results.

## Help

Usage can be accessed by typing

```
python ./app.py --help
```

Or

```
python ./app.py
```

Info regarding individual commands can be accessed by typing

```
python ./app.py --help
```