|
| 1 | +# WESMUN 2026 Delegate Email Sender |
| 2 | + |
| 3 | +A Python script to send personalized committee allocation emails to Model United Nations (MUN) delegates for WESMUN 2026. |
| 4 | + |
| 5 | +## 📋 Overview |
| 6 | + |
| 7 | +This tool automates the process of sending allocation emails to delegates, including: |
| 8 | +- Personalized email content with delegate name and country/portfolio allocation |
| 9 | +- Committee-specific information (agendas, group chat links) |
| 10 | +- PDF attachments (Code of Conduct, Delegate Handbook, Schedule, Waiver Form) |
| 11 | +- Committee-specific Background Guide PDFs |
| 12 | + |
| 13 | +## 📁 Project Structure |
| 14 | + |
| 15 | +``` |
| 16 | +wesmun_del_email/ |
| 17 | +├── sendMail.py # Main email sending script |
| 18 | +├── body.txt # Email body template with placeholders |
| 19 | +├── bodyReplacements.csv # Committee-specific data (agendas, GC links) |
| 20 | +├── chairsEmailLogin.csv # Committee chair email credentials |
| 21 | +├── countryMatrixCSV/ # Delegate allocation CSVs (one per committee) |
| 22 | +│ ├── AL.csv |
| 23 | +│ ├── ECOSOC.csv |
| 24 | +│ ├── GA1.csv |
| 25 | +│ └── ... (other committees) |
| 26 | +├── allAttachments/ # PDF attachments sent to all delegates |
| 27 | +│ ├── Code Of Conduct.pdf |
| 28 | +│ ├── Delegate Handbook.pdf |
| 29 | +│ ├── Schedule.pdf |
| 30 | +│ ├── Waiver Consent Form.pdf |
| 31 | +│ └── BackGroundGuide/ # Committee-specific background guides |
| 32 | +│ ├── AL.pdf |
| 33 | +│ ├── ECOSOC.pdf |
| 34 | +│ └── ... (other committees) |
| 35 | +├── backup/ # Backup of original country matrix files |
| 36 | +└── scripts/ # Utility scripts |
| 37 | + └── csvStripper.py |
| 38 | +``` |
| 39 | + |
| 40 | +## 📝 File Formats |
| 41 | + |
| 42 | +### `countryMatrixCSV/*.csv` (Delegate Data) |
| 43 | +Each committee has a CSV with delegate allocations: |
| 44 | +```csv |
| 45 | +Allocation,Delegate Name,Email |
| 46 | +Bahrain,John doe,email@example.com |
| 47 | +Jordan,Doe John,example@email.com |
| 48 | +``` |
| 49 | + |
| 50 | +### `chairsEmailLogin.csv` (Chair Credentials) |
| 51 | +Email credentials for sending from committee chairs: |
| 52 | +```csv |
| 53 | +name,email,password |
| 54 | +AL,al@wesmun.com,password123 |
| 55 | +ECOSOC,ecosoc@wesmun.com,password456 |
| 56 | +``` |
| 57 | +> ⚠️ **Important**: The `name` column must match the CSV filename in `countryMatrixCSV/` (e.g., `AL` for `AL.csv`) |
| 58 | +
|
| 59 | +### `bodyReplacements.csv` (Committee Info) |
| 60 | +Committee-specific details for email body: |
| 61 | +```csv |
| 62 | +name,Agenda1,Agenda2,GCLink |
| 63 | +AL,Strengthening Regional Peacekeeping,Enhancing Humanitarian Aid,https://gc.link/al |
| 64 | +ECOSOC,Global Economic Recovery,Sustainable Development Goals Review,https://gc.link/ecosoc |
| 65 | +``` |
| 66 | + |
| 67 | +### `body.txt` (Email Template) |
| 68 | +Template with placeholders that get replaced: |
| 69 | +- `[[name]]` - Committee name |
| 70 | +- `[[delegateName]]` - Delegate's name |
| 71 | +- `[[allocation]]` - Country/Portfolio assignment |
| 72 | +- `[[Agenda1]]` - First agenda topic |
| 73 | +- `[[Agenda2]]` - Second agenda topic |
| 74 | +- `[[GCLink]]` - Group chat link |
| 75 | +- `[[name.lower]]` - Committee name in lowercase |
| 76 | + |
| 77 | +## Usage |
| 78 | + |
| 79 | +### Prerequisites |
| 80 | +- Python 3.6+ |
| 81 | +- PurelyMail accounts for `@wesmun.com` email addresses |
| 82 | + - **⚠️ IMPORTANT**: All sender emails MUST be `@wesmun.com` addresses |
| 83 | + - You need the PurelyMail passwords for each committee email account |
| 84 | + - The script validates that all emails are from the `@wesmun.com` domain |
| 85 | + |
| 86 | +### Run Modes |
| 87 | + |
| 88 | +```bash |
| 89 | +# Test run - validates everything without sending emails |
| 90 | +python sendMail.py --testRun |
| 91 | + |
| 92 | +# Fake run - sends all emails to it@wesmun.com (for testing) |
| 93 | +python sendMail.py --fakeRun |
| 94 | + |
| 95 | +# Real run - sends emails to actual delegates with CC to staff |
| 96 | +python sendMail.py --run |
| 97 | +``` |
| 98 | + |
| 99 | +### Command Line Options |
| 100 | + |
| 101 | +| Flag | Description | |
| 102 | +|-------------|--------------------------------------------------------------| |
| 103 | +| `--testRun` | Dry run - logs what would be sent without actually sending | |
| 104 | +| `--fakeRun` | Sends emails to `it@wesmun.com` instead of actual recipients | |
| 105 | +| `--run` | Production mode - sends to real recipients with CC to staff | |
| 106 | + |
| 107 | +### CC Recipients (Production Mode Only) |
| 108 | +When using `--run`, emails are CC'd to: |
| 109 | +- it@wesmun.com |
| 110 | +- secretariat@wesmun.com |
| 111 | +- chiefofstaff@wesmun.com |
| 112 | + |
| 113 | +## Email Details |
| 114 | + |
| 115 | +- **From**: Committee chair email (e.g., `ecosoc@wesmun.com`) |
| 116 | +- **Subject**: "WESMUN 2026 - Committee Allocation" |
| 117 | +- **Attachments**: |
| 118 | + - Code Of Conduct.pdf |
| 119 | + - Delegate Handbook.pdf |
| 120 | + - Schedule.pdf |
| 121 | + - Waiver Consent Form.pdf |
| 122 | + - Committee Background Guide (e.g., `ECOSOC.pdf`) |
| 123 | + |
| 124 | +## Logging |
| 125 | + |
| 126 | +All activity is logged to: |
| 127 | +- **Console**: Real-time status messages |
| 128 | +- **File**: `email_sender.log` (persistent log) |
| 129 | + |
| 130 | +## ⚠️ Important Notes |
| 131 | + |
| 132 | +1. **PurelyMail Setup**: All committee email addresses must be `@wesmun.com` addresses hosted on PurelyMail. The script validates this before sending. |
| 133 | + |
| 134 | +2. **Committee Name Matching**: The committee name in `chairsEmailLogin.csv` and `bodyReplacements.csv` must **exactly match** the CSV filename in `countryMatrixCSV/` (without `.csv` extension). |
| 135 | + |
| 136 | +3. **Email Validation**: The script automatically validates that all sender emails are `@wesmun.com` before processing. If any invalid emails are found, it will exit with an error. |
| 137 | + |
| 138 | +4. **Test First**: Always run with `--testRun` or `--fakeRun` before using `--run` to verify everything is configured correctly. |
| 139 | + |
| 140 | +## 🔧 Troubleshooting |
| 141 | + |
| 142 | +| Issue | Solution | |
| 143 | +|----------------------------------------|--------------------------------------------------------------------------| |
| 144 | +| "Chair info not found for committee X" | Ensure committee name in `chairsEmailLogin.csv` matches the CSV filename | |
| 145 | +| "Replacement info not found" | Ensure committee name in `bodyReplacements.csv` matches the CSV filename | |
| 146 | +| "Invalid sender email" | Ensure all emails in `chairsEmailLogin.csv` end with `@wesmun.com` | |
| 147 | +| Authentication failed | Verify the PurelyMail password is correct for that email address | |
| 148 | +| Connection timeout | Check that PurelyMail SMTP (smtp.purelymail.com:587) is accessible | |
| 149 | + |
| 150 | +## 📜 License |
| 151 | + |
| 152 | +Internal tool for WESMUN 2026 conference organization. |
0 commit comments