958: Add authentication for email relays r=mergify[bot] a=daniel0611

## What type of PR?

Feature

## What does this PR do?
Add support for email relays which require authentication like Mailgun, SendGrid and more.

### Related issue(s)
- Closes #387 

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [X] In case of feature or enhancement: documentation updated accordingly
- [X] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: Daniel Huber <daniel@dani09.de>
Co-authored-by: Daniel Huber <daniel.hub@outlook.de>
master
bors[bot] 5 years ago
commit ba22fb0007

@ -27,6 +27,11 @@ mydestination =
# Relayhost if any is configured
relayhost = {{ RELAYHOST }}
{% if RELAYUSER %}
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
{% endif %}
# Recipient delimiter for extended addresses
recipient_delimiter = {{ RECIPIENT_DELIMITER }}

@ -0,0 +1 @@
{{ RELAYHOST }} {{ RELAYUSER }}:{{ RELAYPASSWORD }}

@ -48,6 +48,11 @@ for map_file in glob.glob("/overrides/*.map"):
os.system("postmap {}".format(destination))
os.remove(destination)
if "RELAYUSER" in os.environ:
path = "/etc/postfix/sasl_passwd"
convert("/conf/sasl_passwd", path)
os.system("postmap {}".format(path))
convert("/conf/rsyslog.conf", "/etc/rsyslog.conf")
# Run Podop and Postfix

@ -57,7 +57,8 @@ Docker services' outbound mail to be relayed, you can set this to ``172.16.0.0/1
to include **all** Docker networks. The default is to leave this empty.
The ``RELAYHOST`` is an optional address of a mail server relaying all outgoing
mail.
mail in following format: ``[HOST]:PORT``.
``RELAYUSER`` and ``RELAYPASSWORD`` can be used when authentication is needed.
The ``FETCHMAIL_DELAY`` is a delay (in seconds) for the fetchmail service to
go and fetch new email if available. Do not use too short delays if you do not

@ -0,0 +1 @@
Relays with authentication
Loading…
Cancel
Save