Fix NAS4Free’s Non-Working Google SMTP After Upgrade

A few days after I updated NAS4Free to (revision 5109), I noticed my e-mail reports were not arriving any longer. After making sure my script was working, I went onto checking my e-mail settings - first by sending a test e-mail.

There I received not really helpful message: "Failed to send test email. Please check the log files." Further check in log showed equaly useless "root: Failed to send test email to:" I guess it was time for the command line.

The easiest way to test e-mail is probably running msmtp directly from SSH and see what its issue is:

# echo "Subject: Test" |& msmtp
msmtp: account default from /usr/local/etc/msmtprc: cannot use tls_trust_file with tls_certcheck turned off

If you check that file, the offending line is indeed there:

# cat /usr/local/etc/msmtprc
account default
port 587
protocol smtp
auth login
password 123
tls on
tls_starttls on
tls_certcheck off
tls_trust_file /usr/local/etc/ssl/cert.pem
syslog LOG_MAIL

The easiest fix for this issue is to enable TLS Server Certificate Check in GUI. This will actually add a bit of security and there are no real downsides if you use Google's SNMP as I do.

If you are using a custom e-mail server with self-signed certificate, removing offending line in post-startup script is your best bet:

sed -i -- '/^tls_trust_file/d' /usr/local/etc/msmtprc

Of course, proper solution would be for GUI to omit TLS trust file configuration when certificate check if off. Due to unrelated changes this seems to be already fixed in source file. Next version will have it all sorted out. :)

[2018-02-16: Issue is fixed in version]

[2018-07-22: NAS4Free has been renamed to XigmaNAS as of July 2018]

Leave a Reply

Your email address will not be published. Required fields are marked *