My new ISP blocks port 25 outbound. Before I changed ISPs I would have a cron job on my linux NAS box perform an mdadm command, create a log file and then mail the log
file to me at my Gmail account. It worked slick for years until my new ISP. I have verified port 25 is blocked and that port 587 is open. I followed some suggestions to get Postfix to use a relay and port 587. That doesn't seem to work. I either don't understand what system to use as the relay or my errors are telling me I'm not authorized to use the relay. The following is the script that checks my RAID and then sends me an email with the body being the log file created by the script.
Code:
##########
# Check for a good internet connection.
wget --spider --quiet http://yahoo.com
if [ "$?" != 0 ]; then
echo "Internet Connection down!" | mail -s "Internet issues" <user>@gmail.com
fi
echo `date` > /tmp/nas-raid-status.log
echo >> /tmp/nas-raid-status.log
/sbin/mdadm --detail /dev/md0 >> /tmp/nas-raid-status.log
echo "-----" >> /tmp/nas-raid-status.log
echo >> /tmp/nas-raid-status.log
echo `date` >> /tmp/nas-raid-status.log
cat /tmp/nas-raid-status.log | mail -s "NAS RAID Status" <user>@gmail.com
##########
The following are the entries I added to my main.cf file in /etc/postfix.
Code:
###########
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:<user>@gmail.com:Password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
relayhost = [smtp.gmail.com]:587
###########
The following are the errors in /var/log/mail.log
Code:
May 26 13:07:47 xxxxxxxx postfix/pickup[4909]: D9398E601AA: uid=0 from=<root@xxxxxxxx.com>
May 26 13:07:47 xxxxxxxx postfix/cleanup[5221]: D9398E601AA: message-id=<20210526190747.D9398E601AA@nas>
May 26 13:07:47 xxxxxxxx postfix/qmgr[4910]: D9398E601AA: from=<root@xxxxxxxx.com>, size=1258, nrcpt=1 (queue active)
May 26 13:07:48 xxxxxxxx postfix/smtp[5223]: D9398E601AA: SASL authentication failed; server smtp.gmail.com[172.253.117.109] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials n12sm14789pjk.48 - gsmtp
May 26 13:07:48 xxxxxxxx postfix/smtp[5223]: connect to smtp.gmail.com[2607:f8b0:400e:c0a::6c]:587: Network is unreachable
May 26 13:07:48 xxxxxxxx postfix/smtp[5223]: D9398E601AA: to=<xxxxxxxx@gmail.com>, relay=none, delay=0.84, delays=0.08/0.02/0.75/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2607:f8b0:400e:c0a::6c]:587: Network is unreachable)
Bookmarks