An automated Python solution for tracking job applications by analyzing emails from multiple accounts and updating a CSV tracking file.
- Multi-Account Email Analysis: Connects to multiple email accounts via IMAP
- Intelligent Filtering: Filters out newsletters, spam, and non-job related emails
- AI-Powered Analysis: Uses OpenAI GPT-4o mini to analyze and classify job-related emails
- CSV Integration: Updates existing job tracking CSV with new information
- Smart Deduplication: Prevents processing the same email multiple times
- Comprehensive Logging: Detailed logging for debugging and monitoring
- Error Handling: Robust error handling and recovery mechanisms
- Parallel Processing: Efficient batch processing of emails
The system can identify and classify the following types of job-related emails:
- application_submitted: Confirmation of job application submission
- interview_invitation: Interview scheduling requests
- rejection: Application rejection notifications
- offer: Job offers
- follow_up: Follow-up communications
- assessment: Technical assessments or tests
- reference_check: Reference check requests
- other: Other job-related communications
- Python 3.8 or higher
- Email accounts with IMAP access enabled
- OpenAI API key
- Existing job tracking CSV file (or one will be created)
-
Clone or download this repository
-
Install required dependencies:
pip install -r requirements.txt- Create a
.envfile from the example:
cp .env.example .env- Edit
.envand add your credentials:- OpenAI API key
- Email account credentials
- CSV file path (optional)
- Enable IMAP in Gmail settings
- For accounts with 2FA enabled, create an App-Specific Password:
- Go to Google Account settings
- Security → 2-Step Verification → App passwords
- Generate a password for "Mail"
- Use this password in the
.envfile
- Enable IMAP in iCloud settings
- Generate an app-specific password:
- Go to Apple ID settings
- Sign-In & Security → App-Specific Passwords
- Create a password for this application
- Use this password in the
.envfile
Run the script:
python src/email_job_tracker.pyThe script will:
- Connect to both email accounts
- Fetch emails since June 1, 2025
- Filter out spam and newsletters
- Analyze remaining emails with OpenAI
- Update the CSV file with job-related information
- Generate a summary report
OPENAI_API_KEY: Your OpenAI API key (required)EMAIL1_ADDRESS: First email address (default: francesco.rosciano@me.com)EMAIL1_PASSWORD: Password for first email account (required)EMAIL2_ADDRESS: Second email address (default: francescorosciano@ucsb.edu)EMAIL2_PASSWORD: Password for second email account (required)JOB_TRACKER_CSV: Path to CSV file (default: Simplify_Tracked_Jobs_2025-07-06 (1).csv)
You can customize the filtering behavior by modifying the following in EmailConfig class:
SPAM_DOMAINS: List of domains to filter outSPAM_KEYWORDS: Keywords indicating spam/newslettersJOB_KEYWORDS: Keywords indicating job-related emailsFOLDERS_TO_SEARCH: Email folders to search
The script expects/creates a CSV with these columns:
- Job Title
- Company Name
- Job URL
- Applied Date
- Status
- Status Date
- Archived
- Date Archived
- Notes
Additional columns added by the script:
- Email Address
- Email Date
- Email Subject
- Email Classification
- Email Hash
- Console output with progress information
- Detailed log file:
email_job_tracker.log
- New job entries are added for unmatched emails
- Existing entries are updated with new status information
- Notes are appended with email-derived information
- Backup created before each update
email_cache.pkl: Stores processed email hashes to avoid reprocessing
The script handles various error scenarios:
- Connection failures
- Invalid credentials
- API rate limits
- Malformed emails
- CSV corruption
All errors are logged with full details for debugging.
- Never commit
.envfile: Add it to.gitignore - Use app-specific passwords: Don't use your main email password
- Secure storage: Keep credentials encrypted if possible
- API key safety: Protect your OpenAI API key
- Regular backups: The script creates CSV backups automatically
- Processes emails in batches for efficiency
- Implements rate limiting for API calls
- Caches processed emails to avoid duplicates
- Parallel processing with configurable workers
-
Authentication Failed
- Check email credentials
- Ensure IMAP is enabled
- Use app-specific passwords for 2FA accounts
-
No Emails Found
- Check date range
- Verify folder names
- Check IMAP settings
-
API Errors
- Verify OpenAI API key
- Check API quota/limits
- Review error logs
-
CSV Update Issues
- Ensure write permissions
- Check CSV format
- Review backup files
For more detailed output, modify the logging level in the script:
logging.basicConfig(level=logging.DEBUG, ...)- Monitor log files for errors
- Clean up old backup files
- Update filtering rules as needed
- Review and adjust OpenAI prompts
pip install --upgrade -r requirements.txtThis project is provided as-is for personal use. Ensure compliance with email provider terms of service and data protection regulations.
For issues or questions:
- Check the log file for detailed error messages
- Review the troubleshooting section
- Ensure all prerequisites are met
- Verify configuration settings