Sign inSign up

kingsquare/postfix

By kingsquare

•Updated about 6 years ago

Image
2

1.4K

kingsquare/postfix repository overview

Docker Build Status Docker Cloud Automated build GitHub Tag GitHub License GitHub language count GitHub top language Docker Pulls Docker Stars

⁠docker-postfix

Postfix in a container with optional SMTP authentication (sasldb), DKIM support, TLS support.

⁠Installation

Pull from docker hub

docker pull kingsquare/postfix

Build local image from repo

docker build -t kingsquare/postfix https://github.com/kingsquare/docker-postfix.git

⁠Usage

  1. Create postfix container with smtp authentication

    docker run \
        -p 25:25 \
        -p 587:587 \
        -e maildomain=mail.example.com \
        -e smtp_user=user:pwd \
        --name postfix \
        -d kingsquare/postfix
    
    # Set multiple user credentials: -e smtp_user=user1:pwd1,user2:pwd2,...,userN:pwdN
    
  2. Create postfix container with smtp authentication

    docker run \
        -p 25:25 \
        -p 587:587 \
        -e maildomain=mail.example.com \
        -e smtp_user=/etc/postfix/smtp_user \
        --name postfix \
        -d kingsquare/postfix
    
    # Set multiple user credentials: -e smtp_user=user1:pwd1,user2:pwd2,...,userN:pwdN
    
    # Set multiple user credentials from file: -v /some/file:/etc/postfix/smtp_users
    
    
  3. Enable OpenDKIM: save your domain key .private in /path/to/domainkeys

    docker run \
        -p 25:25 \
        -p 587:587 \
        -e maildomain=mail.example.com \
        -e smtp_user=user:pwd \
        -e dkimselector=mail \
        -v /path/to/domainkeys:/etc/opendkim/domainkeys \
        --name postfix \
        -d kingsquare/postfix
    
  4. Enable OpenDKIM: override all config with custom directory

    docker run \
        -p 25:25 \
        -p 587:587 \
        -e maildomain=mail.example.com \
        -e smtp_user=user:pwd \
        -e dkimselector=mail \
        -v /path/to/etc/opendkim:/etc/opendkim \
        --name postfix \
        -d kingsquare/postfix
    
  5. Enable TLS: add your SSL certificates .key and .crt files to /path/to/certs. If you have a combined crt+key file then make sure it's extension is .crt

    docker run \
        -p 25:25 \
        -p 587:587 \
        -e maildomain=mail.example.com \
        -e smtp_user=user:pwd \
        -v /path/to/certs:/etc/postfix/certs \
        --name postfix \
        -d kingsquare/postfix
    
  6. Optional Postfix configuration passed using environment variables:

    • inet_protocols

      this allows postfix to limit the outgoing internet protocols to the given param (ipv4, ipv6, all (=default))

    • message_size_limit

      To in-/decrease the message size limit, set this to the required amount in bytes (default: 10240000 = 10MB)

To use this i.e. -e message_size_limit=51200000 to increase the limit to 50MB

⁠Notes

  • 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

76.1 MB

Last updated

about 6 years ago

docker pull kingsquare/postfix