This is a proof of concept experiment. After building this I found an ical link for the calendar I wanted to convert, so I've never deployed this. I still think the idea is good, and I can imagine using this again. This was built in about two hours using claude-3.5-sonnet (and other LLM tools) so it wasn't a big use of time to prototype. (It makes this look much more finished than it is!)
This service receives email newsletters, extracts event information, and generates iCal files accessible via HTTP. It's designed for small-scale, self-hosted use, prioritizing simplicity and ease of maintenance.
- SMTP server to receive emails
- AI-powered event extraction from email content
- iCal file generation for extracted events
- Configuration-based calendar management
- Simple security through secret email addresses
- Python 3.7+
- aiosmtpd
- PyYAML
- anthropic (Claude AI API)
-
Clone the repository:
git clone https://github.com/cthulahoops/mail2ical.git cd mail2ical -
Install poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 - -
Install the project dependencies using poetry:
poetry install -
Copy the example configuration file and edit it to your needs:
cp config.example.yaml config.yaml nano config.yaml
Note: Full installation instructions for setting up on a server with a webserver are a work in progress. This guide covers the basic setup for local development and testing.
The config.yaml file contains all the necessary settings for the service:
- SMTP server settings
- Allowed email senders
- iCal file storage settings
- AI parser settings (Claude API)
- Calendar definitions (name, email address)
Each calendar is defined with a unique name and email address. The email address acts as a secret key for that calendar.
-
Start the email server:
python email_server.py --config config.yaml -
To test the service, use the provided test client:
python test_client.py --config config.yaml --calendar "Work Events"Replace "Work Events" with the name of the calendar you want to test.
-
Send emails containing event information to the email addresses defined in your config file. The service will process these emails and generate iCal files.
Security is maintained by keeping the email addresses for each calendar confidential. Only emails sent to these addresses from allowed senders will be processed.
- This service is designed for small-scale, personal use.
- It relies on the Claude AI API for event extraction, which may incur costs.
- There's no built-in encryption for SMTP (consider using a reverse proxy for TLS).
Contributions are welcome! Please feel free to submit a Pull Request.