This solution sends automated emails to government officials about road conditions in Bedian Road & Ali View Garden area, Lahore.
schedule==1.2.0
pytz==2023.3
Note: Previous versions incorrectly listed secure-smtplib which doesn't exist. The system uses Python's built-in smtplib.
You only need ONE email account to get started!
Choose one of these options:
-
Gmail Account (Recommended)
- Go to gmail.com and create new account
- Enable 2-Factor Authentication
- Generate App Password: Gmail β Settings β Security β App Passwords
- Note down email and app password
-
Outlook Account
- Go to outlook.com and create new account
- Enable 2-Factor Authentication if required
- Note down email and password
-
Yahoo Account
- Go to yahoo.com and create new account
- Generate App Password if 2FA enabled
- Note down email and password
Optional: Create 2-3 accounts for better rotation and anti-blocking protection.
-
Create New Repository
# Create new repo on GitHub # Name: government-road-complaints # Description: Automated system for road infrastructure complaints # Set to Private for security
-
Add Files to Repository
government-road-complaints/ βββ .github/ β βββ workflows/ β βββ send-daily-emails.yml βββ src/ β βββ send_single_email.py β βββ test_email.py β βββ setup.py β βββ config.py βββ docs/ β βββ QUICK_START.md β βββ GITHUB_SECRETS_GUIDE.md β βββ SETUP_SECRETS.md β βββ DEPLOYMENT_CHECKLIST.md βββ requirements.txt βββ README.md βββ media/ βββ road_photo1.jpg βββ road_photo2.jpg βββ pothole_video.mp4 βββ flooding_video.mp4 -
Add Your Media Files
- Take photos/videos of road conditions
- Upload to
media/folder in repository - Supported formats: JPG, PNG, MP4, MOV, PDF, DOC, ZIP, and more
- Keep file sizes under 25MB each
- NEW: System automatically discovers all valid files
Go to your repository β Settings β Secrets and Variables β Actions β New Repository Secret
Minimum Setup (1 Email Service):
GMAIL_EMAIL = your_gmail@gmail.com
GMAIL_APP_PASSWORD = your_gmail_app_password
OR
OUTLOOK_EMAIL = your_outlook@outlook.com
OUTLOOK_PASSWORD = your_outlook_password
OR
YAHOO_EMAIL = your_yahoo@yahoo.com
YAHOO_PASSWORD = your_yahoo_password
Optional (For Better Rotation): Add all 6 secrets if you want to use multiple email services.
-
Install Dependencies Locally (Optional)
pip install -r requirements.txt
-
Run Local Tests
python src/test_email.py
-
Manual GitHub Test
- Go to Actions tab in your repository
- Click "Government Road Complaint Emails (Mon/Wed/Fri)"
- Click "Run workflow" β "Run workflow"
- Check if emails are sent successfully
The automated schedule will run Monday, Wednesday, and Friday at 9:00 AM Pakistan Time automatically once the workflow file is in place.
- Uses up to 3 different email services (Gmail, Outlook, Yahoo)
- Rotates between services to avoid single-service blocking
- Different templates and content each day
- 3 different email templates (English formal, Urdu, Legal)
- Templates rotate based on day of year
- Unique timestamps and reference numbers
- Natural language variations
- Random delays between 10-60 seconds
- Professional, legitimate complaint format
- Proper email headers and formatting
- Reduced frequency: Mon/Wed/Fri only (not daily)
- Professional subject lines
- Legitimate government complaint content
- Proper email authentication
- Timezone-aware timestamps
- Emergency tone with constitutional references
- Detailed impact documentation
- Comparison with better-maintained areas
- Professional formatting
- Respectful Urdu language
- Cultural context appropriate
- Government protocol compliant
- Local context emphasis
- Legal framework references
- Constitutional rights basis
- Escalation timeline mentioned
- Documentation emphasis
βββ src/ # Python source code
β βββ send_single_email.py # Main email sender (UPDATED)
β βββ test_email.py # Test suite (ENHANCED)
β βββ setup.py # Setup script
β βββ config.py # Configuration (UPDATED)
βββ docs/ # Documentation
β βββ QUICK_START.md # Quick setup guide
β βββ GITHUB_SECRETS_GUIDE.md # Secrets configuration
β βββ SETUP_SECRETS.md # Complete setup guide
β βββ DEPLOYMENT_CHECKLIST.md # Deployment checklist
βββ .github/workflows/
β βββ send-daily-emails.yml # GitHub Actions workflow (Mon/Wed/Fri)
βββ requirements.txt # Python dependencies (FIXED)
βββ README.md # This guide
βββ media/ # Your photos/videos (AUTO-DISCOVERED)
βββ [any_photo_name].jpg
βββ [any_video_name].mp4
βββ [any_document_name].pdf
- No more fixed filenames - use any descriptive names
- 22 supported file types - images, videos, documents, archives
- Smart size management - automatic validation and limits
- Detailed logging - shows what's included/skipped
- Pakistan Standard Time (PKT) support with
pytz - Accurate scheduling - proper UTC to PKT conversion
- Timezone-aware timestamps in all emails
- Specific SMTP errors - authentication, connection, sending
- File validation - type, size, accessibility checks
- Better debugging - detailed error messages and solutions
- Mon/Wed/Fri only - more sustainable approach
- Professional pattern - avoids daily spam appearance
- Better compliance - less likely to trigger filters
- Walton Cantonment Board
- Punjab CM Office
- Local Development Authority
- District Administration Lahore
- Punjab Highway Department
- Monday: Administrative focus
- Wednesday: Follow-up and escalation
- Friday: Weekly summary and pressure
- Check execution status Mon/Wed/Fri
- Monitor email sending success
- Track template rotation
- View detailed error messages
- Monitor government responses
- Track media coverage
- Document any action taken
- Maintain complaint log
-
"No module named 'pytz'" Error
pip install pytz # or pip install -r requirements.txt -
Emails Not Sending
- Check GitHub Secrets are set correctly
- Verify email passwords/app passwords
- Check spam folders for test emails
-
Workflow Not Running
- Look for "Government Road Complaint Emails (Mon/Wed/Fri)" (exact name)
- Check cron syntax:
0 4 * * 1,3,5(Mon/Wed/Fri at 4 AM UTC) - Verify repository is not archived
-
Media Files Not Found
- Ensure files are in
media/directory - Check file types are supported (see list above)
- Verify files are under 25MB each
- Ensure files are in
# Install dependencies
pip install -r requirements.txt
# Test configuration
python src/test_email.py
# Check GitHub Actions status
# Go to repository β Actions β Latest run- Modify cron schedule:
0 4 * * *for daily - Add multiple sends per day
- Target different officials at different times
- ProtonMail accounts
- Custom SMTP servers
- Business email accounts
- Regular photo/video updates
- Drone footage of area
- Time-lapse documentation
- Comparative area photos
- Constitutional right to petition government
- Freedom of expression protection
- Citizen complaint mechanisms
- Public service accountability
- Respectful communication tone
- Factual information only
- No threatening language
- Clear identification as automated system
- GitHub Actions: 2000 minutes/month (free)
- Email accounts: Free versions sufficient
- File storage: GitHub repository free
- Total Monthly Cost: $0
- GitHub Pro: $4/month (more Actions minutes)
- Premium email accounts: $5-10/month
- Custom domain: $10-15/year
- Email delivery success rate > 95%
- Zero email account blocks
- Template rotation working
- Government acknowledgment received
- Media coverage of issue
- Government inspection visit
- Preliminary repair work started
- Community support mobilized
- Complete road reconstruction
- Drainage system installation
- Street lighting restored
- Regular maintenance schedule
- Install dependencies:
pip install -r requirements.txt - Create at least one email account (Gmail, Outlook, or Yahoo)
- Set up GitHub repository
- Add all code files
- Upload media files (any supported format, any filename)
- Configure GitHub Secrets (minimum 1 email service)
- Test:
python src/test_email.py - Test manual workflow execution
- Verify Mon/Wed/Fri automation is working
- Monitor for government responses
Your automated government accountability system is now ready! π
Latest Update: Enhanced with automatic file discovery, timezone support, improved error handling, and reduced to Mon/Wed/Fri schedule for better sustainability.