4.0 KiB
4.0 KiB
Quick Start Guide - Email Rules Sync
What This Does
✅ Reads email rules from AWS DynamoDB ✅ Generates Sieve scripts for Out-of-Office auto-replies ✅ Generates Postfix virtual aliases for email forwarding ✅ Syncs every 5 minutes automatically
Setup (5 Minutes)
Step 1: Setup Sudo Permissions
cd /home/timo/config-email/sync
./setup-sudo.sh
This allows the sync script to change file ownership without password prompts.
Step 2: Test Manual Sync
sudo node sync.js
You should see:
✅ Found X email rules
✅ Created Sieve script for user@domain.com
✅ Updated virtual aliases
✅ Postfix reloaded
✅ Dovecot reloaded
Step 3: Install Cron Job
./install-cron.sh
This sets up automatic syncing every 5 minutes.
Verify It's Working
Check Logs
tail -f /tmp/email-rules-sync.log
Check Sieve Scripts (Auto-Reply)
# For support@qrmaster.net
cat /home/timo/docker-mailserver/docker-data/dms/mail-data/qrmaster.net/support/home/.dovecot.sieve
Check Virtual Aliases (Forwarding)
cat /home/timo/docker-mailserver/docker-data/dms/config/postfix-virtual.cf
Test Auto-Reply
- Go to Roundcube → Settings → Email Configuration
- Click "Open Email Configuration"
- Enable "Out of Office"
- Set message: "I'm out until Monday"
- Click "Update Rule"
- Wait 5 minutes (or run
sudo node sync.jsmanually) - Send an email to that address
- You should receive an auto-reply! 🎉
Test Forwarding
- Go to Roundcube → Settings → Email Configuration
- Click "Open Email Configuration"
- Go to "Email Forwarding" tab
- Add forward address:
your@email.com - Click "Update Rule"
- Wait 5 minutes (or run
sudo node sync.jsmanually) - Send an email to that address
- You should receive it at your forward address! 🎉
Architecture
┌──────────────┐
│ React UI │ ← User configures rules
└──────┬───────┘
│
↓
┌──────────────┐
│ Express API │ ← Saves to DynamoDB
└──────┬───────┘
│
↓
┌──────────────┐
│ DynamoDB │ ← Rules stored here
└──────┬───────┘
│
↓ (Every 5 min)
┌──────────────┐
│ Sync Script │ ← YOU ARE HERE
└──────┬───────┘
│
↓
┌──────────────────────────────┐
│ Mail Server │
│ ┌────────┐ ┌────────────┐ │
│ │ Sieve │ │ Postfix │ │
│ │ OOO │ │ Forwarding │ │
│ └────────┘ └────────────┘ │
└──────────────────────────────┘
Troubleshooting
Sync fails with permission error
Run: ./setup-sudo.sh
Auto-reply not working
-
Check Sieve script was created:
sudo node sync.js # Look for "✅ Created Sieve script for..." -
Check Dovecot logs:
docker logs mailserver-new 2>&1 | grep -i sieve
Forwarding not working
-
Check virtual aliases:
cat /home/timo/docker-mailserver/docker-data/dms/config/postfix-virtual.cf -
Check Postfix logs:
docker logs mailserver-new 2>&1 | grep -i virtual -
Manually reload:
docker exec mailserver-new postfix reload
Next Steps
- ✅ Setup sudo permissions
- ✅ Test manual sync
- ✅ Install cron job
- ✅ Test auto-reply
- ✅ Test forwarding
- 🎉 Enjoy automated email rules!
Files
sync.js- Main sync scriptsetup-sudo.sh- Setup sudo permissionsinstall-cron.sh- Install cron job.env- Configuration (AWS credentials)QUICKSTART.md- This fileREADME.md- Detailed documentation