diff --git a/mail/mailtest.txt b/mail/mailtest.txt new file mode 100644 index 0000000..eb519ca --- /dev/null +++ b/mail/mailtest.txt @@ -0,0 +1,3 @@ +to: stewart@bennell.me +subject:Subject Test + diff --git a/mail/main.cf b/mail/main.cf new file mode 100644 index 0000000..178145b --- /dev/null +++ b/mail/main.cf @@ -0,0 +1,22 @@ +# See /usr/share/postfix/main.cf.dist for a commented, more complete version + +myhostname=SVR-1-VH1.lab-network.xyz + +smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) +biff = no + +# appending .domain is the MUA's job. +append_dot_mydomain = no + +# Uncomment the next line to generate "delayed mail" warnings +#delay_warning_time = 4h + +inet_protocols = ipv4 +relayhost = [smtp.office365.com]:587 +smtp_sasl_auth_enable = yes +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +smtp_sasl_security_options = noanonymous +smtp_tls_security_level = may +sender_canonical_maps = regexp:/etc/postfix/sender_canonical +smtp_tls_CAfile = /etc/postfix/cacert.pem +smtp_use_tls = yes diff --git a/patch.sh b/patch.sh index 84b78a3..8faf36b 100644 --- a/patch.sh +++ b/patch.sh @@ -30,7 +30,9 @@ echo "- Seting up smtp for email alerts" apt install postfix sasl2-bin mailutils -y apt install libsasl2-modules -y rm -f /etc/postfix/{mailtest.txt,main.cf,sasl_passwd,sender_canonical} -wget --user=bennellit --ask-password -P /etc/postfix/ https://bennellit.com.au/Files/noaccess/{mailtest.txt,main.cf,sasl_passwd,sender_canonical} +wget -nc -P /etc/postfix/ https://raw.githubusercontent.com/sbennell/pve-patch/master/mail/mailtest.txt +wget -nc -P /etc/postfix/ https://raw.githubusercontent.com/sbennell/pve-patch/master/mail/main.cf +wget --user=bennellit --ask-password -P /etc/postfix/ https://bennellit.com.au/Files/noaccess/{sasl_passwd,sender_canonical} postmap hash:/etc/postfix/sasl_passwd postmap hash:/etc/postfix/sender_canonical chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db @@ -38,6 +40,6 @@ chmod 644 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db chown root:root /etc/postfix/sender_canonical /etc/postfix/sender_canonical.db chmod 644 /etc/postfix/sender_canonical /etc/postfix/sender_canonical.db service postfix restart -sendmail -v server@lab-network.xyz +sendmail -v server@lab-network.xyz < /etc/postfix/mailtest.txt echo "- done!"