initial
This commit is contained in:
171
sync/QUICKSTART.md
Normal file
171
sync/QUICKSTART.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
./install-cron.sh
|
||||
```
|
||||
|
||||
This sets up automatic syncing every 5 minutes.
|
||||
|
||||
## Verify It's Working
|
||||
|
||||
### Check Logs
|
||||
|
||||
```bash
|
||||
tail -f /tmp/email-rules-sync.log
|
||||
```
|
||||
|
||||
### Check Sieve Scripts (Auto-Reply)
|
||||
|
||||
```bash
|
||||
# For support@qrmaster.net
|
||||
cat /home/timo/docker-mailserver/docker-data/dms/mail-data/qrmaster.net/support/home/.dovecot.sieve
|
||||
```
|
||||
|
||||
### Check Virtual Aliases (Forwarding)
|
||||
|
||||
```bash
|
||||
cat /home/timo/docker-mailserver/docker-data/dms/config/postfix-virtual.cf
|
||||
```
|
||||
|
||||
## Test Auto-Reply
|
||||
|
||||
1. Go to Roundcube → Settings → Email Configuration
|
||||
2. Click "Open Email Configuration"
|
||||
3. Enable "Out of Office"
|
||||
4. Set message: "I'm out until Monday"
|
||||
5. Click "Update Rule"
|
||||
6. Wait 5 minutes (or run `sudo node sync.js` manually)
|
||||
7. Send an email to that address
|
||||
8. You should receive an auto-reply! 🎉
|
||||
|
||||
## Test Forwarding
|
||||
|
||||
1. Go to Roundcube → Settings → Email Configuration
|
||||
2. Click "Open Email Configuration"
|
||||
3. Go to "Email Forwarding" tab
|
||||
4. Add forward address: `your@email.com`
|
||||
5. Click "Update Rule"
|
||||
6. Wait 5 minutes (or run `sudo node sync.js` manually)
|
||||
7. Send an email to that address
|
||||
8. 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
|
||||
|
||||
1. Check Sieve script was created:
|
||||
```bash
|
||||
sudo node sync.js
|
||||
# Look for "✅ Created Sieve script for..."
|
||||
```
|
||||
|
||||
2. Check Dovecot logs:
|
||||
```bash
|
||||
docker logs mailserver-new 2>&1 | grep -i sieve
|
||||
```
|
||||
|
||||
### Forwarding not working
|
||||
|
||||
1. Check virtual aliases:
|
||||
```bash
|
||||
cat /home/timo/docker-mailserver/docker-data/dms/config/postfix-virtual.cf
|
||||
```
|
||||
|
||||
2. Check Postfix logs:
|
||||
```bash
|
||||
docker logs mailserver-new 2>&1 | grep -i virtual
|
||||
```
|
||||
|
||||
3. Manually reload:
|
||||
```bash
|
||||
docker exec mailserver-new postfix reload
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. ✅ Setup sudo permissions
|
||||
2. ✅ Test manual sync
|
||||
3. ✅ Install cron job
|
||||
4. ✅ Test auto-reply
|
||||
5. ✅ Test forwarding
|
||||
6. 🎉 Enjoy automated email rules!
|
||||
|
||||
## Files
|
||||
|
||||
- `sync.js` - Main sync script
|
||||
- `setup-sudo.sh` - Setup sudo permissions
|
||||
- `install-cron.sh` - Install cron job
|
||||
- `.env` - Configuration (AWS credentials)
|
||||
- `QUICKSTART.md` - This file
|
||||
- `README.md` - Detailed documentation
|
||||
Reference in New Issue
Block a user