forked from very-emmazing/docker-postfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postfix.sh
26 lines (22 loc) · 953 Bytes
/
postfix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
set -eu
echo "Configuring postfix"
echo "${relayhost} ${relayuser}:${relaypassword}" > /etc/postfix/sasl_password
postmap /etc/postfix/sasl_password
postconf -e "inet_protocols = ipv4"
postconf -e "maillog_file = /dev/stdout"
postconf -e "mydestination = localhost"
postconf -e "mydomain = ${mydomain}"
postconf -e "myhostname = ${myhostname:-mail}.${mydomain}"
postconf -e "mynetworks = ${mynetworks:-192.168.0.0/16,172.16.0.0/12}"
postconf -e "myorigin = ${mydomain}"
postconf -e "relayhost = ${relayhost}:${relayport:-587}"
postconf -e "smtp_host_lookup = native,dns"
postconf -e "smtp_sasl_auth_enable = yes"
postconf -e "smtp_sasl_password_maps = hash:/etc/postfix/sasl_password"
postconf -e "smtp_sasl_security_options = noanonymous"
postconf -e "smtp_use_tls = yes"
echo "nameserver 1.1.1.1" > /var/spool/postfix/etc/resolv.conf
echo "nameserver 1.1.1.1" > /etc/resolv.conf
echo "Starting postfix"
exec /usr/sbin/postfix start-fg