Lightweight (based on Alpine) Docker image for running a (fake) local SMTP server to test outgoing emails (powered by MailCatcher).
To launch a container from this image, you must have Docker installed. If already, run the below command:
$ docker run -d --name mailcatcher -p 1025:1025 -p 8025:8025 syncloudsoftech/mailcatcherTo start/stop the (named) container at a later point in time, use below commnads:
# start "mailcatcher" named container
$ docker start mailcatcher
# stop "mailcatcher" named container
$ docker stop mailcatcher
Once running, you can access the webmail on http://127.0.0.1:8025/ page.
To include this container as a service in your existing docker-compose.yml setup, use below definition:
version: '3'services:
mailcatcher:
image: syncloudsoftech/mailcatcherenvironment:
HTTP_PORT: '8025'# optionalSMTP_PORT: '1025'# optionalports:
- '1025:1025'
- '8025:8025'If your app is built with Laravel, you can configure it to use our docker service by adding below configuration to the .env file.
MAIL_MAILER=smtp# or use MAIL_HOST=127.0.0.1 if using host networkMAIL_HOST=mailcatcherMAIL_PORT=1025MAIL_USERNAME=nullMAIL_PASSWORD=nullMAIL_ENCRYPTION=nullMAIL_FROM_ADDRESS="hello@example.com"MAIL_FROM_NAME="${APP_NAME}"If your app uses nodemailer, configure it to use our docker service using below code:
consttransporter=nodemailer.createTransport({host: 'mailcatcher',// or use 127.0.0.1 if using host networkport: 1025,secure: false,});Building or modifying the container yourself from source is also quite easy. Just clone the repository and run below command:
$ docker build -t mailcatcher .Run the locally built container as follows:
$ docker run -it -p 1025:1025 -p 8025:8025 mailcatcherSince MailCatcher also includes a REST API for retrieving emails, it's super-easy to use it in testing workflows. See https://mailcatcher.me/#api for documentation.
See the LICENSE file.