# postfix [**Package DB** (owner)](https://admin.fedoraproject.org/pkgdb/package/modules/postfix/) | [**F26 modulemd** (source)](http://pkgs.fedoraproject.org/cgit/modules/postfix.git/tree/postfix.yaml?h=f26) | [**PDC** (result)](https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?active=True&variant_name=postfix) Postfix is a Mail Transport Agent (MTA). ## Current state | State | Description | |-------|-------------| | ✓ YES | **Build passes** in the infra (all build deps are ok) | | ✓ YES | **Installs** on the Base Runtime (all runtime deps are ok) | | ✓ YES | **No bootstrap** - uses only proper modules | | ✓ YES | General **tests are in dist-git** | | ✓ YES | General **tests pass** | | ✗ NO | Meets the **Fedora Module Packaging Guidelines** | ### Notes See [**README**](https://github.com/container-images/postfix) on github for more details. See [**hub.docker**](https://hub.docker.com/r/modularitycontainers/postfix/) for Dockerimage. ## Summary - Dockerfile.DOVECOT - build container image with dovecot w/o postfix. - Dockerfile.POSTFIX - build container image with postfix w/o dovecot. - Dockerfile.IMAP - build container image with dovecot and postfix installed. Full IMAP server. - Dockerfile.TLS - build container image with postfix TLS enabled w/o dovecot. - imap-template.yml - Template for OpenShift to start IMAP server with two containers (postfix and dovecot) ## How to build the container on 25 port ```docker build --tag=postfix .``` ## How to build the container with TLS enabled ```docker build -f Docker.TLS --tag=postfix . ``` ## How to build the container with dovecot service ```docker build -f Docker.IMAP --tag=postfix .``` ## How to use the container over standard 25 port Command for running postfix docker container: ``` docker run -it -e MYHOSTNAME=localhost \ -p 25:10025\ -v $(pwd)/tmp/postfix:/var/spool/postfix \ -v $(pwd)/tmp/mail:/var/spool/mail postfix ``` ## How to use the container over standard TLS Dockerfile for TLS port is Dockerfile.TLS. Command for running postfix docker container: ``` docker run -it -e DEBUG_MODE=yes -e MYHOSTNAME=localhost \ -p 25:10025 \ postfix ``` Environment variable DEBUG_MODE is used for debugging proposes from Postfix and dovecot point of views. ## How to use the container with IMAP with TLS enabled (dovecot and Postfix) Dockerfile which uses IMAP is Dockerfile.IMAP. Command for running postfix docker container: ``` docker run -it -e MYHOSTNAME=localhost -e DEBUG_MODE \ -p 25:10025 -p 587:10587 -p 143:10143 \ postfix ``` Environment variable DEBUG_MODE is used for debugging proposes from Postfix and dovecot point of views. Docker container does NOT share user from HOST system. Therefore I prefer to create users in container. This is not yet automated. Will be SOON. Steps are: ```docker exec -n postfix /bin/bash``` ```/file/create_user.sh ``` Now the user can be used for mail clients. ## How to test the postfix mail server Commands for testing Postfix docker container: ```telnet localhost 25``` ```HELO test.localhost``` ```MAIL FROM:@``` ```RCPT TO:``` ```DATA``` and type whatever you want ``` Subject: My testing docker container image Hi, Testing message regards Docker . ``` ## How to test the postfix mail server with TLS Command for testing Postfix docker container with enabled TLS is ```openssl```. Telnet has not to be used because of all communication is encrypted from the beginning. ``` openssl s_client -starttls smtp -crlf -connect localhost:25 ``` ## How to test the postfix with dovecot service Command for testing Postfix docker container with dovecot is ```openssl```. Telnet has not to be used because of all communication is encrypted from the beginning. Testing dovecot service with ```openssl``` ``` openssl s_client -starttls imap -connect localhost:143 ``` Testing postfix service with ```openssl``` ``` openssl s_client -debug -starttls smtp -crlf -connect localhost:25 ```