This project sets up a Mailpit container (mailpit
) for handling email testing and development.
- Docker installed and running (https://docs.docker.com/engine/install/)
- Docker Compose installed and running (https://docs.docker.com/compose/install/)
This docker-compose.yml file utilizes environment variables to customize configurations. You can set these variables before running commands:
MP_MAX_MESSAGES
: Maximum number of messages to retain (defaults to5000
)MP_DATABASE
: Path to the Mailpit database (defaults to/data/mailpit.db
)MP_SMTP_AUTH_ACCEPT_ANY
: Accept any SMTP authentication (defaults to1
)MP_SMTP_AUTH_ALLOW_INSECURE
: Allow insecure SMTP authentication (defaults to1
)WEB_PORT
: Port to expose the Mailpit web interface (defaults to8025
)SMTP_PORT
: Port to expose the Mailpit SMTP interface (defaults to1025
)
Recommendation: Customize these environment variables in the docker-compose.yml
file or use a .env
file to set them as per your requirements.
-
Create a
.env
file (optional):-
Create a file named
.env
in the same directory as yourdocker-compose.yml
file. -
Add environment variable definitions in the format
KEY=VALUE
, one per line. For example:MP_MAX_MESSAGES=5000 MP_DATABASE=/data/mailpit.db MP_SMTP_AUTH_ACCEPT_ANY=1 MP_SMTP_AUTH_ALLOW_INSECURE=1
-
-
Start the services:
docker-compose up -d
- This will create and start the Mailpit container in detached mode (background).
-
Access Mailpit:
- Open your web browser and navigate to
http://localhost:<WEB_PORT>
, replacing<WEB_PORT>
with the port you configured(default: 8025)
.
- Open your web browser and navigate to