Skip to content

run postfix with smtp authentication (sasldb) in a docker container

License

Notifications You must be signed in to change notification settings

stempler/docker-postfix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-postfix

run postfix with smtp authentication (sasldb) in a docker container. TLS and OpenDKIM support are optional.

Requirement

  • Docker 1.0

Installation

  1. Build image

    $ sudo docker pull stempler/postfix

Usage

  1. Create postfix container with smtp authentication

    $ sudo docker run -p 25:25 \
    		-e maildomain=mail.example.com -e smtp_user=user:pwd \
    		--name postfix -d stempler/postfix
    # Set multiple user credentials: -e smtp_user=user1:pwd1,user2:pwd2,...,userN:pwdN
  2. Enable OpenDKIM: save your domain key .private in /path/to/domainkeys. Note that the image assumes mail as the name of the selector of the domain key.

    $ sudo docker run -p 25:25 \
    		-e maildomain=mail.example.com -e smtp_user=user:pwd \
    		-v /path/to/domainkeys:/etc/opendkim/domainkeys \
    		--name postfix -d stempler/postfix
  3. Enable TLS(587): save your SSL certificates .key and .crt to /path/to/certs

    $ sudo docker run -p 587:587 \
    		-e maildomain=mail.example.com -e smtp_user=user:pwd \
    		-v /path/to/certs:/etc/postfix/certs \
    		--name postfix -d stempler/postfix

Additional configuration options

Mail forwarding

To enable simple mail forwarding for the whole mail domain to an external address, use the mail_forward_to environment variable, for example:

Note

  • Login credential should be set to ([email protected], password) in Smtp Client
  • You can assign the port of MTA on the host machine to one other than 25 (postfix how-to)
  • Read the reference below to find out how to generate domain keys and add public key to the domain's DNS records

Reference

About

run postfix with smtp authentication (sasldb) in a docker container

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%