Giter VIP home page Giter VIP logo

docker-postfix's Introduction

Mail Relay for Docker Containers

This is a simple container running postfix. It will accept mails and relay them over an authenticated smarthost to their destination.

Mails will be accepted on Port 25 for delivery without authentication by the containers. Access control is meant to happen on the network level, i.e. by limiting which hosts/containers can connect to the relay and whitelisting network addresses.

Building

Building the container will fetch debian:bullseye-slim as the container's base.

$ docker-compose build

Configuration

Edit env.sample and save it as env.

  • mydomain: Domain part of outgoing mail addresses
  • relayhost: fqdn for your relay host
  • relayuser: username for authentication at the remote mail relay
  • relaypassword: password for authentication at the remote mail relay

Optional configuration:

  • myhostname: Hostname the docker container should assume for itself. Defaults to mail.
  • mynetworks: Networks (CIDR) that are whitelisted for mail delivery. Defaults to 192.168.0.0/16,172.16.0.0/12.
  • relayport: Port the remote mail relay is reachable at. Defaults to 587 (submission)

Running

Start the container:

$ docker-compose up -d

Watch logfiles:

$ docker-compose logs -f

App configuration

Make sure your apps' docker-compose.yaml have the mail network configured for all services that should be able to send mails, e.g.:

---
version: "3.5"
services:
  busybox:
    image: busybox
  networks:
    - mail
networks:
  mail:
    external: true
    name: mail

Pay attention to the networks settings (both of them).

Then, configure your apps to the following settings:

  • SMTP Host: mail_postfix_1
  • SMTP Port: 25
  • SMTP Auth: none at all
  • StartTLS/SSL: Only StartTLS will work on port 25. It's possible, but not required when all containers run on the same machine and communication doesn't go over the wire.
  • Certificate validation: off. We won't generate valid certificates for mail_postfix_1.

Copyright

Florian Heinle [email protected]

MIT-License (see LICENSE)

docker-postfix's People

Contributors

fheinle avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.