Node based SMTP server with rule engine
561
A modern, feature-rich SMTP server with a beautiful web UI for managing and processing emails based on customizable rules.
# Database Configuration
DATABASE_URL="file:/path/to/your/database.db" # SQLite database path
# SMTP Server Configuration
SMTP_HOST="0.0.0.0" # SMTP server host, use 0.0.0.0 to accept all connections
SMTP_PORT="2525" # SMTP server port
SMTP_MAX_SIZE="31457280" # Maximum email size in bytes (default: 30MB)
# Web UI Configuration
NEXT_PUBLIC_HOST="0.0.0.0" # Web UI host
PORT="3000" # Web UI port
# Kafka Integration (Optional)
KAFKA_BROKERS="localhost:9092" # Comma-separated list of Kafka brokers
KAFKA_CLIENT_ID="email-rules" # Kafka client ID
# Email Forwarding Configuration (Optional)
FORWARD_SMTP_HOST="smtp.gmail.com" # SMTP server for forwarding emails
FORWARD_SMTP_PORT="587" # SMTP port for forwarding
FORWARD_SMTP_USER="[email protected]" # SMTP username
FORWARD_SMTP_PASS="your-password" # SMTP password
FORWARD_SMTP_SECURE="true" # Use TLS
# Development Options
NODE_ENV="production" # Set to 'development' for development mode
DEBUG="smtp*" # Enable SMTP server debugging
# Pull the image
docker pull ${{ secrets.DOCKER_USERNAME }}/mailrelay-smtp-server:latest
# Run with environment variables
docker run -d \
-p ${PORT:-3000}:3000 \
-p ${SMTP_PORT:-2525}:2525 \
-e DATABASE_URL=file:/app/data/mailrelay.db \
-e SMTP_HOST=0.0.0.0 \
-e SMTP_PORT=2525 \
-e NEXT_PUBLIC_HOST=0.0.0.0 \
-e PORT=3000 \
-v $(pwd)/data:/app/data \
--name mailrelay \
${{ secrets.DOCKER_USERNAME }}/mailrelay-smtp-server:latest
version: '3.8'
services:
mailrelay:
image: ${{ secrets.DOCKER_USERNAME }}/mailrelay-smtp-server:latest
ports:
- "${PORT:-3000}:3000" # Web UI
- "${SMTP_PORT:-2525}:2525" # SMTP Server
environment:
- DATABASE_URL=file:/app/data/mailrelay.db
- SMTP_HOST=0.0.0.0
- SMTP_PORT=2525
- SMTP_MAX_SIZE=31457280
- NEXT_PUBLIC_HOST=0.0.0.0
- PORT=3000
- NODE_ENV=production
# Add optional variables as needed
- KAFKA_BROKERS=${KAFKA_BROKERS}
- FORWARD_SMTP_HOST=${FORWARD_SMTP_HOST}
- FORWARD_SMTP_PORT=${FORWARD_SMTP_PORT}
- FORWARD_SMTP_USER=${FORWARD_SMTP_USER}
- FORWARD_SMTP_PASS=${FORWARD_SMTP_PASS}
volumes:
- ./data:/app/data # Persist database
Create a .env file in the root directory:
# Required Configuration
DATABASE_URL=file:/app/data/mailrelay.db
SMTP_HOST=0.0.0.0
SMTP_PORT=2525
NEXT_PUBLIC_HOST=0.0.0.0
PORT=3000
# Optional Configuration
KAFKA_BROKERS=localhost:9092
FORWARD_SMTP_HOST=smtp.gmail.com
FORWARD_SMTP_PORT=587
[email protected]
FORWARD_SMTP_PASS=your-app-specific-password
FORWARD_SMTP_SECURE=true
Access the Web UI:
http://localhost:3000 in your browserSend Test Emails:
# Using telnet
telnet localhost 2525
# Using swaks
swaks --to [email protected] --from [email protected] --server localhost --port 2525
# Using curl
curl smtp://localhost:2525 --mail-from [email protected] --mail-rcpt [email protected] --upload-file email.txt
Create Rules:
# Clone the repository
git clone https://github.com/yourusername/mailrelay-smtp-server.git
# Install dependencies
npm install
# Initialize database
npx prisma generate
npx prisma migrate dev
# Start development servers
npm run dev
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Content type
Image
Digest
sha256:453f08913…
Size
410.5 MB
Last updated
over 1 year ago
docker pull starzeus/mailrelay-smtp-server:sha-ddfe86c