Sign inSign up

nanasess/postfix-relayhost

By nanasess

Updated over 7 years ago

Run postfix with smtp relay.

Image
0

550

nanasess/postfix-relayhost repository overview

postfix-relayhost

Run postfix with smtp relay.

Requirement

  • Docker 1.0

Installation

  1. Build image
$ docker pull nanasess/postfix-relayhost

Usage

  1. Create postfix container with relayhost

    Save your relay_password to /path/to/relay_password

    [relayhost.example.com]:587	[email protected]:password
    

    Execute the docker run command.

    $ docker run -p 1025:25 \
    	-e mynetworks="172.17.0.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128"
    	-e maildomain=mail.example.com \
    	-e relayhost="[relayhost.example.com]:587" \
    	-v "/path/to/relay_password:/etc/postfix/relay_password" \
    	--name postfix-relayhost -d nanasess/postfix-relayhost
    
  2. 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 catatnight/postfix
    # Set multiple user credentials: -e smtp_user=user1:pwd1,user2:pwd2,...,userN:pwdN
    
  3. Enable OpenDKIM: save your domain key .private in /path/to/domainkeys

    $ 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 catatnight/postfix
    
  4. 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 catatnight/postfix
    

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

Tag summary

Content type

Image

Digest

Size

90.6 MB

Last updated

over 7 years ago

docker pull nanasess/postfix-relayhost