Emails from UPS(nut) is sent with extra mail headers that ISP blocks

orjan-

Dabbler
Joined
Apr 17, 2018
Messages
20
I have set up Email on the web-gui with a ISP that hosts my domain and email, a typical authenticated smtp, port 587 with STARTTLS with a valid sender address. When I configured the Email on the web-gui the test mail worked perfectly, however the UPS(nut) emails are being blocked with smtp error 550 due to two headers that are added for email sent by UPS(nut). When UPS sends emails it calls the script "/usr/local/bin/custom-upssched-cmd EMAIL" that uses the "mail" program to send email.
The headers added are:
X-Mailer: FreeNAS
X-FreeNAS-Host: HOSTNAME.DOMAIN

Is there a way to avoid mail/sendmail from adding these two headers?
If not, then it might be a good idea to change email sending method to the same as used on the web-gui test email. That way if the test mail works, then all email notification work.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I know this isn't the solution you want to hear, but the easiest solution to this would be to set up an account at some other email host.

What's the error message that you're getting?
Could you talk to the ISP and find out why they think those headers are worth blocking?
Is the message blocked from being received or blocked from being sent? I suppose SMTP indicates they're blocked from sending.

You could probably set up a jail with an SMTP server that just relays the messages after stripping out those headers. I was recently looking at doing this and there are some very simple Python libraries you could use.
 

orjan-

Dabbler
Joined
Apr 17, 2018
Messages
20
I have not found a way to fix this issue. Googling it mostly shows people asking about disabling the x-mailer header when using PHP, and PHP has a setting in it's configuration to add or not to add the x-mailer header. On my own servers I use postfix as mail server to relay all messages through my ISP, and postfix does not by default include these headers. I'm guessing that these headers can be disabled in mail server config in freenas, but I cant seem to find mail server config in the default locations, so I'm guessing that mail server config is stored in a database and created at boot like most settings in freenas.

Using gmail instead of my ISP works. Creating a jail with postfix mail server might also be an option.

The way I understand it, is that the 550 error is a SMTP error used for "rejected email" and will usually be used with different rejected reasons. So the mail server block the email in the early sending stage. I think more and more ISPs try to block use other than personal use, so it's probably just a matter of time before other mail server providers suddenly block emails due to special headers that normal clients don't use.

One of the big problems in this case is that the test email on the web-gui works perfectly. This is most likely because the email from the test email is sent from a programming language that does not include the header even if using the same sendmail interface to send the mail. USP(NUT) might be the only case where emails are sent outside the code used on the test email. One solution could be to create a wrapper script for NUT that uses the same code as used on the test email on the web-gui, that way the test email would either fail or work for everything.
 
Top