Simplest, Easist and Smallest Email Forward Service based on Docker.
- Config by one line
- Run as docker start
- Image Size 10MB
View on Github - https://github.com/zixia/docker-simple-mail-forwarder
If you have a domain name, only want to have a(or a few) email address from this domain, but forward all the emails to gmail(etc). SMF is exactly what you need. (with Docker)
This docker was built for maximum simple & easy to use because of this reason. I had many domains and need email address of them(for fun/work), and I hate config mail server. Some dns providers provide free email forwarding service for their own domain. some do not. And almose all email forwarding service is not free. So I decided to make it myself(thanks docker).
- DuoCircle Email Forwarding From $59.95/year
- Cloud Mail In From $9/month. And it is not for human.
- MailGun professional service. Free plan includes 10,000 emails/month. but can result in your domain being treated as spam
I was about to pay $10/year maybe, but the cheapest plan is $9 per month. Having a $10 USD machine with unlimited mail&domains/month is an amazing idea! And of couse you also could put other dockers in this machine. :-D
Just set SMF_CONFIG
and run:
$ export SMF_CONFIG='[email protected]:[email protected]:test'
$ docker run -p 25:25 zixia/simple-mail-forwarder
Don't forget to modify the DNS MX record of your domain. (in this example, it's testo.com)
This will forward all email received by [email protected], to [email protected].
See? There is nothing easier.
Done with BATS(Bash Automated Testing System), a bash implementation of TAP(Test Anything Protol).
How to run:
$ docker run zixia/simple-mail-forwarder test
>> exec bats test
1..20
ok 1 confirm hostname pretend to work.
ok 2 confirm hwclock pretend to work.
ok 3 service postfix could start/stop right.
ok 4 SMF_CONFIG exist
ok 5 SMF_DOMAIN exist
ok 6 virtual maping source is set
ok 7 virtual maping data is set
ok 8 virtual maping db is set
ok 9 system hostname FQDN resolvable
ok 10 postfix myhostname FQDN & resolvable
ok 11 check other hostname setting
ok 12 confirm postfix is running
ok 13 confirm port 25 is open
ok 14 crond is running
ok 15 ESMTP STATTLS supported
ok 16 ESMTP AUTH supported
ok 17 ESMTP STARTTLS supported
ok 18 create user [email protected] by password test
ok 19 ESMTP AUTH by [email protected]/test
ok 20 ESMTP TLS AUTH by [email protected]/test
You are set! :-]
SMF_CONFIG
: MUST be defined. no default setting. (set me! I'm the only parameter~)
Here's how to config the only environment parameter of SMF Docker:
Forward all email received by [email protected], to [email protected]:
$ export SMF_CONFIG='[email protected]:[email protected]'
You could get the ESMTP AUTH password for your on your docker log. It's random generated if you do not provide one.
Add ESMTP AUTH password:
$ export SMF_CONFIG='[email protected]:[email protected]:ThisIsPassword'
Password will print on the docker log.
Add as many email as you want, with or without password. Seperated by semicolons or newline:
$ export SMF_CONFIG='[email protected]:[email protected]:ThisIsPassword;[email protected]:[email protected]:AnotherPassword'
Tips: if you only provide the first password, and omit followings, then the passwords of all users will be the same as the password last seen. This is a feature.
- Build from source.
$ ./script/build.sh latest
- Run a self-test for SMF docker.
$ ./script/run.sh latest test
- Get a shell inside SMF docker.
$ ./script/devshell.sh latest
$ telnet 127.0.0.1 25
> 220 testo.com ESMTP
ehlo test.com
> 250-testo.com
> 250-STARTTLS
> 250-AUTH PLAIN LOGIN
auth plain
> 334
dGVzdGlAdGVzdG8uY29tAHRlc3RpQHRlc3RvLmNvbQB0ZXN0
> 235 2.7.0 Authentication successful
quit
> 221 2.0.0 Bye
> Connection closed by foreign host
P.S. The magic string dGVzdGlAdGVzdG8uY29tAHRlc3RpQHRlc3RvLmNvbQB0ZXN0
stands for [email protected]\[email protected]\0test
in base64 encode, required by AUTH PLAIN.
Useful article about SMTP Authentication: http://www.fehcom.de/qmail/smtpauth.html
Github Issue - https://github.com/zixia/docker-simple-mail-forwarder/issues
- switch FROM image from alpine to sillelien/base-alpine
- manage postfix service by S6
- solve PID 1 Zombie Problem
- enhanced busybox shell
- NOT to use OpenRC(very buggy run inside docker container) any more!
- better ESMTP TLS AUTH test script
- docker image size: 10MB
- CI(continuous integration) supported by use CircleCI
- CD(continuous delivery) supported by use Tutum Button
- write better tests
- tune OpenRC inside alpine linux
- full description README
- docker image size: 7MB
- supported specify user password
- supported ESMTP TLS
- docker image size: 7MB
- dockerized
- basic forward function
- self-testing
- docker image size: 6MB
- A Cloud Service that could host docker is required.
- DigitalOcean.com
- A Docker management platform is recommanded.
- Docker is required.
- Docker.com
Zhuohuan LI [email protected] (http://linkedin.com/in/zixia)
- Code & Documentation 2015© zixia
- Code released under the Apache 2.0 license
- Docs released under Creative Commons