78 lines
1.4 KiB
Markdown
78 lines
1.4 KiB
Markdown
# Mail Server Setup for Testing
|
|
|
|
## Quick Start
|
|
|
|
1. **Start the mail server:**
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
2. **Create a test user:**
|
|
```bash
|
|
docker exec -it mailserver setup email add test@example.com password123
|
|
```
|
|
|
|
3. **Verify the server is running:**
|
|
```bash
|
|
docker-compose ps
|
|
```
|
|
|
|
## IMAP Connection Details
|
|
|
|
- **Host:** localhost
|
|
- **IMAP Port:** 143 (unencrypted) or 993 (SSL/TLS)
|
|
- **Username:** test@example.com
|
|
- **Password:** password123
|
|
|
|
## Useful Commands
|
|
|
|
```bash
|
|
# Stop the mail server
|
|
docker-compose down
|
|
|
|
# View logs
|
|
docker-compose logs -f mailserver
|
|
|
|
# List all email accounts
|
|
docker exec -it mailserver setup email list
|
|
|
|
# Add another user
|
|
docker exec -it mailserver setup email add user2@example.com pass456
|
|
|
|
# Delete a user
|
|
docker exec -it mailserver setup email del test@example.com
|
|
|
|
# Access the container shell
|
|
docker exec -it mailserver bash
|
|
```
|
|
|
|
## Testing with telnet
|
|
|
|
You can test IMAP connectivity:
|
|
```bash
|
|
telnet localhost 143
|
|
```
|
|
|
|
Then try IMAP commands:
|
|
```
|
|
a1 LOGIN test@example.com password123
|
|
a2 LIST "" "*"
|
|
a3 SELECT INBOX
|
|
a4 LOGOUT
|
|
```
|
|
|
|
## Send Test Email
|
|
|
|
```bash
|
|
# From within the container
|
|
docker exec -it mailserver bash
|
|
echo "Test email body" | mail -s "Test Subject" test@example.com
|
|
```
|
|
|
|
Or use SMTP (port 25/587) from your application.
|
|
|
|
## Troubleshooting
|
|
|
|
- Check logs: `docker-compose logs mailserver`
|
|
- Ensure ports aren't already in use
|
|
- Data persists in `./docker-data/` directory
|