/docker-postfix-smtp

SMTP Server with postfix, sasl authentication and Opendkim enabled

Primary LanguageShellMIT LicenseMIT

docker-postfix-smtp

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

Installation

  1. Clone the codes

    git clone https://github.com/a-lang/docker-postfix-smtp.git
  2. Pull the image

    docker pull alangtw/postfix-smtp:trusty

Usage

  1. Run the container

    ./run.sh
  2. Create the SSL self-signed certificates for your domain, save the certificates .key and .crt in data/certs

    docker exec -it postfix openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
    -keyout  /etc/postfix/certs/smtp-mydomain-com.key \
    -out /etc/postfix/certs/smtp-mydomain-com.crt
  3. Create DKIM key, save your domain key .private in data/domainkeys

    docker exec -it postfix sh -c "cd /etc/opendkim/domainkeys && opendkim-genkey -t -s mail -d mydomain.com"
  4. Stop the container then re-start it

    ./stop.sh
    ./run.sh

Note

  • SMTP login credential should be set to (username@mydomain.com, password) in Smtp Client
  • You also need to modify the DNS setting for TXT records with SPF, DKIM and DMARC info.

Reference