A service that automatically downloads emails and extracts attachments using POP3/IMAP protocols, with support for multiple accounts and extensive configuration options.
IMPORTANT NOTICE: This project is currently in Beta Stage and should not be used in production environments. It is under active development with core functionality still being implemented and tested. Contributors are welcome to help improve stability and feature completeness.
- Multiple Account Support
- Tracking of Processed Emails
- POP3 Protocol Support
- TLS Support
- Custom Port Configuration
- Delete After Download Option
- IMAP Protocol Support
- TLS Support
- Custom Port Configuration
- OAuth2 Support (in work)
- Attachment Handling
- File Type Filtering (configurable)
- Size Limits (configurable)
- Custom Naming Patterns
- Date-based Directory Structure
- Duplicate File Handling
- Filename Sanitization
- Nested Attachment Scanning
- Storage Interface
- File Storage
- Google Drive
- S3 compatible Bucket Storage
- Filter for TimePeriod IMAP
- Filter for TimePeriod POP3
- TLS Configuration
- Minimum Version Control
- Certificate Verification
- OAuth2 Support (in work, for IMAP)
- API Security
- API Key Authentication
- IP Allowlisting
- CORS Configuration
- Rate Limiting
- Health Checks
- Prometheus Metrics
- Tracing (Jaeger)
- Performance Profiling
- Alert System
- Email Notifications
- Configurable Thresholds
- Error Rate Monitoring
- Response Time Monitoring
- Disk Usage Monitoring
- Template-based Configuration
- Environment Variable Support
- Hot Reload Support
- Validation
- Required Fields
- Value Ranges
- File Extensions
- Path Validation
- Structured Logging (JSON/Text)
- Log Levels
- Caller Information
- Sensitive Data Redaction
- Log Rotation
- Size-based Rotation
- Age-based Retention
- Compression
- Configurable Intervals
- Immediate Start Option
- Start/Stop Times
- Multiple Schedule Support
- Create required directories:
mkdir -p /opt/email-extractor/{config/templates,data/attachments}
chmod 755 /opt/email-extractor/data/attachments
- Copy configuration files:
cp config/templates/base.yaml /opt/email-extractor/config/templates/
cp config/default.config.yaml.template /opt/email-extractor/config/default.config.yaml
-
Configure your settings (see Configuration Guide)
-
Run with Docker:
docker-compose up -d
See the Configuration Guide for detailed setup instructions.
Essential variables:
POP3_SERVER=mail.example.com
POP3_USERNAME=[email protected]
POP3_PASSWORD=secure_password
ATTACHMENT_STORAGE_PATH=/data/attachments
Optional monitoring variables:
ALERT_EMAIL=[email protected]
JAEGER_ENDPOINT=http://jaeger:14268/api/traces
LOG_FILE_PATH=/var/log/email-extractor.log
The service provides a health check endpoint:
curl http://localhost:9999/health
When enabled, metrics are available at:
curl http://localhost:9999/metrics
Current Version: 0.1.0
The service is in active development with core functionality working:
- Basic email processing
- Attachment extraction
- Configuration management
- Monitoring setup
- IMAP support
- OAuth2 integration (planned)
- Web UI (planned)
- API (planned)
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Email Extractor now supports OAuth2 authentication for IMAP servers. This provides a more secure way to authenticate with email providers like Gmail and Microsoft Outlook without storing your password.
To use OAuth2 authentication, update your configuration file as follows:
email:
protocols:
imap:
# ... other settings ...
security:
oauth2:
enabled: true
provider: "google" # or "microsoft"
client_id: "your-client-id"
client_secret: "your-client-secret"
token_storage_path: "/path/to/tokens"
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Select "Desktop app" as the application type
- Enter a name for your client ID
- Copy the Client ID and Client Secret to your configuration file
- Important: Add
http://localhost:8085/oauth/callback
as an authorized redirect URI
- Go to the Azure Portal
- Navigate to "Azure Active Directory" > "App registrations"
- Click "New registration"
- Enter a name for your application
- Select "Accounts in any organizational directory and personal Microsoft accounts"
- Set the redirect URI to
http://localhost:8085/oauth/callback
- Click "Register"
- Copy the Application (client) ID to your configuration file
- Navigate to "Certificates & secrets"
- Create a new client secret and copy it to your configuration file
Email Extractor provides CLI commands to manage OAuth2 tokens:
email-extractor oauth2 generate default
This will open a browser window to authenticate with the provider. After authentication, you'll be redirected to a local page confirming the success.
email-extractor oauth2 list
email-extractor oauth2 delete default
OAuth2 tokens are automatically refreshed when they expire, so you don't need to manually regenerate them.