This project was created for two main reasons:
- Learning Project: As a practical project to learn and deepen my Go programming skills. Working with IMAP, containers, and concurrent programming provides an excellent opportunity to apply various aspects of Go in practice.
- Practical Problem: My email provider unfortunately doesn't offer sufficient spam filtering mechanisms. With this tool, I can use SpamAssassin as an additional filtering layer to keep my inbox clean.
go-mailshield connects to your IMAP accounts, regularly checks for new emails, and forwards them to SpamAssassin for spam detection. Emails identified as spam are moved to the configured spam folder.
- Monitoring of multiple IMAP accounts
- Integration with SpamAssassin for reliable spam detection
- Fully containerized solution with Docker
- Configurable check intervals
- Option to check only unread emails
- Docker and Docker Compose
- Go 1.22+ (for development only)
- Clone the repository:
git clone https://github.com/yourusername/go-mailshield.git
cd go-mailshield- Create a configuration file:
cp config.yaml.dist config.yaml-
Adjust the configuration (see Configuration section)
-
Start with Docker:
docker compose up -dEdit the config.yaml according to your needs:
poll_interval: 30s # Check interval
workers: 2 # Number of parallel workers
accounts:
- name: "primary"
host: "imap.example.com:993"
tls: true
username: "user@example.com"
password: "yourpassword"
inbox: "INBOX"
spam_folder: "Spam"
search_unseen_only: trueFor development, you can run SpamAssassin in a container and your Go app locally:
# Start only SpamAssassin
docker compose up spamassassin
# In another terminal
go run .- Uses the go-imap library for IMAP communication
- SpamAssassin runs in a separate Docker container
- Implements goroutines for parallel processing
- Uses Context for clean shutdown handling
- Handling for the "worker" config value is missing
- Logging instead of output
MIT
This project is a personal learning project and is actively being developed.