Public | Automated Build

Last pushed: 2 years ago
Short Description
SpaceAge's mail forwarder
Full Description

Simple Mail Forwarder(SMF)

Simplest and Smallest Email Forward Service based on Docker.

  1. Config by one line
  2. Run as docker start
  3. Image Size 10MB

View on Github -

What is SMF? (Simple Mail Forwarder)

If you had a domain name and only wanted to have one(or a few) email address from this domain, but you want to forward all the emails to another email account. SMF is exactly what you need. (with Docker)

This docker was built for ultimate simplicity because of this reason. I owned many domains and needed email addresses of them(for fun/work), and I hated to config email 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).

Related Services

I was willing to pay $10/year, but the cheapest plan I could find was $9 per month. Having a $10 USD machine with unlimited mail&domains per month is an amazing idea! And of couse you could also put other dockers on this same machine. :-D

Quick Start (TL;DR)

Just set SMF_CONFIG and run:

$ export SMF_CONFIG=''
$ docker run  -e SMF_CONFIG=$SMF_CONFIG -p 25:25 zixia/simple-mail-forwarder

Don't forget to modify the DNS MX record of your domain. (in this example, it's

This will forward all emails received by to

See? There is nothing easier.

Quick Test

Tested by 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
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 by password test
ok 19 ESMTP AUTH by

You are all set! :-]

Environment Variable and Default Values

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:

1. Basic

Forward all emails received by to

$ export SMF_CONFIG=''

You could get the ESMTP AUTH password for you on your docker log. It's randomly generated if you do not provide one.

2. Advanced

Add ESMTP AUTH password:

$ export SMF_CONFIG=''

Password will be printed on the docker log.

3. Hardcore

Add as many email accounts as you want, with or without password. Seperated by semicolon or a new line:

$ export SMF_CONFIG=';'

Tips: if you only provide the first password and leave the rest blank, then the passwords for all the rest accounts will be the same as the last password value you set. This is by design.

Helper Scripts

  1. Build from source.

    $ ./script/ latest
  2. Run a self-test for SMF docker.

    $ ./script/ latest test
  3. Get a shell inside SMF docker.

    $ ./script/ latest

Manual Test

$ telnet 25
> 220 ESMTP
auth plain
> 334
> 235 2.7.0 Authentication successful
> 221 2.0.0 Bye
> Connection closed by foreign host

P.S. The magic string dGVzdGlAdGVzdG8uY29tAHRlc3RpQHRlc3RvLmNvbQB0ZXN0 stands for `\\0test` in base64 encoding, required by AUTH PLAIN.

Useful article about SMTP Authentication:


Github Issue -



  • close issue #1
  • increace message size limit from 10MB to 40MB


v0.3.0 <- Don't use me, I'm BUGGY

  • 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

v0.2.0 <- Don't use me, I'm BUGGY

  • supported specify user password
  • supported ESMTP TLS
  • docker image size: 7MB


  • dockerized
  • basic forward function
  • self-testing
  • docker image size: 6MB

Cloud Requirement

  • A Cloud Service that could host docker is required.
  • A Docker management platform is recommanded.
  • Docker is required.


Zhuohuan LI (

<a href="">
<img src="" width="208" height="58" alt="profile for zixia at Stack Overflow, Q&A for professional and enthusiast programmers" title="profile for zixia at Stack Overflow, Q&A for professional and enthusiast programmers">

Copyright & License

  • Code & Documentation 2015© zixia
  • Code released under the Apache 2.0 license
  • Docs released under Creative Commons
Docker Pull Command