Sign inSign up

helder/mailcatcher

By helder

Updated about 9 years ago

Image
2

100K+

helder/mailcatcher repository overview

docker-mailcatcher

Mailcatcher docker image to catch emails during development.

Basic usage

There are two exposed ports. Use port 25 to send emails to, and 80 to access the web interface where your emails will be shown.

Run mailcatcher process:

docker run -d -p 1080:80 --name mail helder/mailcatcher

Link to another container to send emails:

docker run -it --link mail ...

In this example emails should be sent to host mail and port 25.

Example with a PHP container and ssmtp

ssmtp is a very lightweight send-only sendmail emulator. Let's see an example of how we can override sendmail:

# Dockerfile
FROM helder/php

RUN apt-install ssmtp && \
    echo "sendmail_path = /usr/sbin/ssmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini && \
    echo "mailhub=mail:25\nUseTLS=NO\nFromLineOverride=YES" > /etc/ssmtp/ssmtp.conf

Now test PHP's mail() function:

docker run -it --rm --link mail helder/php php -r 'mail("[email protected]", "Test", "Testing!", "From: [email protected]");'

Open your browser at http://localhost:1080 to see your emails.

Tag summary

Content type

Image

Digest

sha256:70b3974d4

Size

35.6 MB

Last updated

about 9 years ago

docker pull helder/mailcatcher