Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV MT_NETWORK_STYLE subnet
RUN apt-get update && apt-get install -q -y \
postfix \
dovecot-imapd \
sqlite \
sqlite3 \
php \
php-mbstring \
php-sqlite3 \
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DOCKER_REPO:=agilesyndrome/mailtrap
DOCKER_TAG:=test

build:
docker build -t $(DOCKER_REPO):$(DOCKER_TAG) .
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,23 @@ Set environment variables
* `MT_MAILBOX_LIMIT` - mailbox limit in bytes, default 51200000
* `MT_MESSAGE_LIMIT` - message limit in bytes, default 10240000
* `MT_NETWORK_STYLE` - [host, subnet, or class](http://www.postfix.org/postconf.5.html#mynetworks_style), default subnet

* `MT_POSTFIX_OPTIONS` - http://www.postfix.org/postconf.5.html, any other options you need.
and recreate the container.

## Testing the image locally

```
sudo docker build -t eaudeweb/mailtrap:test .
make build
sudo docker-compose up
```

## Running on a centralized server / if you're seeing Relay access denied
If you're running on a centralized server you need to specify who is allowed to send to the embedded postfix instance option.

To do this you'll need to know the network subnet of the machines that you would allow to send mail to this mailtrap instance. With the subnet in hand for example "10.10.0.0/16" add this to the allowed senders by adding the following environment option
MT_POSTFIX_OPTIONS = 10.10.0.0/16


## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand All @@ -76,4 +83,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
mail:
container_name: sys_mail
restart: unless-stopped
image: eaudeweb/mailtrap:test
image: agilesyndrome/mailtrap:test
ports:
- "127.0.0.1:8125:80"
- "127.0.0.1:2525:25"
Expand Down
20 changes: 20 additions & 0 deletions sendTestMessage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

import smtplib


fromaddr = "[email protected]"
toaddrs = ["[email protected]", "[email protected]"]

msg = """From: A Sender <[email protected]>
To: Envelope To <[email protected]>
Subject: SMTP e-mail test

This is a very basic test e-mail message.
You can see you can change the envelope from/to at the stop of this string.
"""

server = smtplib.SMTP('localhost:2525')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()