https://github.com/syncloudsoftech/mailcatcher
Lightweight (based on Alpine) Docker image for running a (fake) local SMTP server to test outgoing emails (powered by MailCatcher).
https://github.com/syncloudsoftech/mailcatcher
alpine alpine-linux docker email mail mailcatcher mailhog smtp smtp-server testing
Last synced: 4 months ago
JSON representation
Lightweight (based on Alpine) Docker image for running a (fake) local SMTP server to test outgoing emails (powered by MailCatcher).
- Host: GitHub
- URL: https://github.com/syncloudsoftech/mailcatcher
- Owner: syncloudsoftech
- License: mit
- Created: 2022-10-27T03:03:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-27T17:23:16.000Z (over 1 year ago)
- Last Synced: 2024-08-01T13:27:32.287Z (7 months ago)
- Topics: alpine, alpine-linux, docker, email, mail, mailcatcher, mailhog, smtp, smtp-server, testing
- Language: Dockerfile
- Homepage: https://syncloudsoft.com/
- Size: 11.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mailcatcher
Lightweight (based on [Alpine](https://www.alpinelinux.org/)) [Docker](https://www.docker.com) image for running a (fake) local [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol) server to test outgoing emails (powered by [MailCatcher](https://mailcatcher.me)).

## Usage
To launch a container from this image, you must have [Docker](https://www.docker.com) installed.
If already, run the below command:```shell
$ docker run -d --name mailcatcher -p 1025:1025 -p 8025:8025 syncloudsoftech/mailcatcher
```To 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/](http://127.0.0.1:8025/) page.
### docker-compose.yml
To include this container as a service in your existing `docker-compose.yml` setup, use below definition:
```yml
version: '3'services:
mailcatcher:
image: syncloudsoftech/mailcatcher
environment:
HTTP_PORT: '8025' # optional
SMTP_PORT: '1025' # optional
ports:
- '1025:1025'
- '8025:8025'
```### Laravel
If your app is built with [Laravel](https://laravel.com/), you can configure it to use our docker service by adding below configuration to the `.env` file.
```env
MAIL_MAILER=smtp
# or use MAIL_HOST=127.0.0.1 if using host network
MAIL_HOST=mailcatcher
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
```### Node.js
If your app uses [nodemailer](https://nodemailer.com/), configure it to use our docker service using below code:
```js
const transporter = nodemailer.createTransport({
host: 'mailcatcher', // or use 127.0.0.1 if using host network
port: 1025,
secure: false,
});
```## Development
Building or modifying the container yourself from source is also quite easy.
Just clone the repository and run below command:```shell
$ docker build -t mailcatcher .
```Run the locally built container as follows:
```shell
$ docker run -it -p 1025:1025 -p 8025:8025 mailcatcher
```## Testing
Since [MailCatcher](https://mailcatcher.me) also includes a REST API for retrieving emails, it's super-easy to use it in testing workflows. See [https://mailcatcher.me/#api](https://mailcatcher.me/#api) for documentation.
## License
See the [LICENSE](LICENSE) file.