Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

output
133 changes: 121 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,134 @@
# Maily
Script to send automated emails with a google account.

1. Create an OAuth2.0 token here: [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/oauth2)
2. Store the Credentials on a file called: credentials.json
3. Create a venv:
Django Girls Colombia automated email script for workshop notifications and certificates.

## Features

This script supports sending 5 different types of workshop-related emails:

1. **`certificate`** - Post-workshop certificates for attendees
2. **`accepted-participants`** - Acceptance notifications for workshop participants
3. **`waitlist-participants`** - Waitlist notifications for participants
4. **`accepted-mentors`** - Acceptance notifications for mentors/guides
5. **`waitlist-mentors`** - Waitlist notifications for mentors

### Local Testing Mode

The script includes a `--local` flag that generates HTML preview files instead of sending emails, perfect for testing templates and data before sending actual emails.

## Setup

### 1. Google API Credentials

Create an OAuth2.0 token here: [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/oauth2)

Store the credentials in a file called: `credentials.json`

### 2. Environment Setup

Create and activate a virtual environment:

```bash
# Create virtual environment
python3 -m venv env
```
4. Activate the environment:
```bash
# Unix

# Activate the environment
# Unix/macOS
source env/bin/activate

# Windows
env\Scripts\activate
```
5. Install the requirements:

### 3. Install Dependencies

```bash
pip install -r requirements.txt
```
6. Run the script:

### 4. Prepare Data Files

Ensure your data files are properly formatted:

- `data/attendees.csv` - Contains columns: `email`, `name`, `certificate_url`
- `data/mentors.csv` - Contains columns: `email`, `name`

## Usage

### Basic Syntax

```bash
python main.py
```
python main.py --type <message_type> [--local]
```

### Message Types

- `certificate` - Uses `data/attendees.csv`
- `accepted-participants` - Uses `data/attendees.csv`
- `waitlist-participants` - Uses `data/attendees.csv`
- `accepted-mentors` - Uses `data/mentors.csv`
- `waitlist-mentors` - Uses `data/mentors.csv`

### Local Testing (Recommended)

Test your templates and data before sending emails:

```bash
# Test certificate emails
python main.py --type certificate --local

# Test mentor acceptance emails
python main.py --type accepted-mentors --local

# Test participant waitlist emails
python main.py --type waitlist-participants --local
```

HTML preview files will be generated in the `output/` directory with names like:
- `certificate_John_Doe.html`
- `accepted_mentors_Maria_Garcia.html`
- `waitlist_participants_Ana_Rodriguez.html`

### Sending Actual Emails

Remove the `--local` flag to send real emails:

```bash
# Send certificate emails to all attendees
python main.py --type certificate

# Send acceptance emails to all mentors
python main.py --type accepted-mentors
```

### Help

```bash
python main.py --help
```

## Templates

Templates are stored in the `templates/` directory:

- `certificate_template.html` - Certificate email template
- `participantes_aceptados.html` - Accepted participants template
- `participantes_lista_espera.html` - Participants waitlist template
- `guias_aceptados.html` - Accepted mentors template
- `guias_lista_espera.html` - Mentors waitlist template

Templates use variables like `{participant_name}`, `{mentor_name}`, `{workshop_date}`, `{email_header_url}`, etc., which are automatically replaced with actual data.

## Configuration

Workshop details and email settings are configured as constants in `main.py`:

- Workshop date, time, and location
- Survey and photo links
- Email header image URL (`EMAIL_HEADER_URL`)
- Confirmation deadlines
- Email delay settings

## Security Note

Never commit `credentials.json` or `token.json` to version control. These files contain sensitive authentication information.
11 changes: 11 additions & 0 deletions credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"installed": {
"client_id": "your-client-id.apps.googleusercontent.com",
"project_id": "your-project-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "your-client-secret",
"redirect_uris": ["http://localhost"]
}
}
File renamed without changes.
5 changes: 5 additions & 0 deletions data/mentors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
email,name
maria.garcia@example.com,María García
ana.rodriguez@example.com,Ana Rodríguez
laura.martinez@example.com,Laura Martínez
sofia.lopez@example.com,Sofía López
Loading