From cb373828fc9210a13265eddef0b986912ac15d7b Mon Sep 17 00:00:00 2001 From: Juan Luis Baptiste Date: Wed, 13 May 2015 01:06:38 -0500 Subject: [PATCH] Set myhostname and myorigin, some providers like 1&1 will do MX lookups on them so they need to be valid. --- run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.sh b/run.sh index 6aaecc8..2d8ea38 100644 --- a/run.sh +++ b/run.sh @@ -4,11 +4,17 @@ [ -z "${SMTP_USERNAME}" ] && echo "SMTP_USERNAME is not set" && exit 1 [ -z "${SMTP_PASSWORD}" ] && echo "SMTP_PASSWORD is not set" && exit 1 +DOMAIN=`echo $SERVER_HOSTNAME |awk -F. '{$1="";OFS="." ; print $0}' | sed 's/^.//'` + +echo "myhostname=$SERVER_HOSTNAME" >> /etc/postfix/main.cf +echo "mydomain=$DOMAIN" >> /etc/postfix/main.cf +echo 'myorigin=$mydomain' >> /etc/postfix/main.cf echo "relayhost = [$SMTP_SERVER]:587" >> /etc/postfix/main.cf echo "smtp_use_tls=yes" >> /etc/postfix/main.cf echo "smtp_sasl_auth_enable = yes" >> /etc/postfix/main.cf echo "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" >> /etc/postfix/main.cf echo "smtp_sasl_security_options = noanonymous" >> /etc/postfix/main.cf + echo "[$SMTP_SERVER]:587 $SMTP_USERNAME:$SMTP_PASSWORD" >> /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd