|
| 1 | +# Mail Sink |
| 2 | + |
| 3 | +A simple SMTP server for testing email flows locally. It provides a REST API to access received emails and includes a web UI. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- SMTP server that captures all incoming emails |
| 8 | +- Parses email content including HTML, plain text, and attachments |
| 9 | +- REST API to retrieve emails and clear the mailbox |
| 10 | +- Web UI for viewing and managing emails |
| 11 | +- Single binary deployment with embedded UI |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Building |
| 16 | + |
| 17 | +You can use the provided Makefile to build both the UI and the Go binary in one step: |
| 18 | + |
| 19 | +```bash |
| 20 | +# Build everything |
| 21 | +make |
| 22 | + |
| 23 | +# Or separately |
| 24 | +cd ui |
| 25 | +npm install |
| 26 | +npm run build |
| 27 | +cd .. |
| 28 | +go build -o mail-sink |
| 29 | +``` |
| 30 | + |
| 31 | +### Running |
| 32 | + |
| 33 | +Using the Makefile: |
| 34 | + |
| 35 | +```bash |
| 36 | +# Run with default settings |
| 37 | +make run |
| 38 | + |
| 39 | +# Run with custom ports |
| 40 | +make run-custom SMTP_PORT=2525 HTTP_PORT=3000 |
| 41 | +``` |
| 42 | + |
| 43 | +Or directly: |
| 44 | + |
| 45 | +```bash |
| 46 | +# Run with default settings |
| 47 | +./mail-sink |
| 48 | + |
| 49 | +# Run with custom ports |
| 50 | +./mail-sink --smtp-port 2525 --http-port 3000 |
| 51 | +``` |
| 52 | + |
| 53 | +### Development |
| 54 | + |
| 55 | +To run the UI in development mode with hot reloading: |
| 56 | + |
| 57 | +```bash |
| 58 | +# Start the Go server |
| 59 | +./mail-sink |
| 60 | + |
| 61 | +# In another terminal, start the UI development server |
| 62 | +cd ui |
| 63 | +npm run dev |
| 64 | +``` |
| 65 | + |
| 66 | +This will start the UI development server that proxies API requests to the Go backend. |
| 67 | + |
| 68 | +### Command line options |
| 69 | + |
| 70 | +- `--smtp-port PORT`: SMTP server port (default: 1025) |
| 71 | +- `--http-port PORT`: HTTP server port (default: 8080) |
| 72 | +- `--help`: Show help |
| 73 | + |
| 74 | +## API |
| 75 | + |
| 76 | +The following API endpoints are available: |
| 77 | + |
| 78 | +- `GET /api/emails`: Get all received emails |
| 79 | +- `GET /api/emails/:id`: Get a specific email by ID |
| 80 | +- `DELETE /api/emails`: Clear all emails |
| 81 | +- `GET /api/info`: Get server information (ports) |
| 82 | + |
| 83 | +## SMTP Configuration |
| 84 | + |
| 85 | +To send emails to the Mail Sink, configure your email client or application with: |
| 86 | + |
| 87 | +- SMTP Server: localhost |
| 88 | +- SMTP Port: 1025 (or custom port) |
| 89 | +- Authentication: None required (all authentication attempts are accepted) |
| 90 | + |
| 91 | +## License |
| 92 | + |
| 93 | +MIT |
0 commit comments