What traces will failure to send email notifications leave?

Joined
Jul 13, 2013
Messages
286
I've had intermittent email notifications, and I'm finally getting around to trying to chase this down.

I've viewed other threads, I think I have all the bits configured. (I'd describe the required configuration as both arcane, and not very well documented.)

I'm expecting that I would find traces in the FreeNAS system log files of attempts to send email notifications, and if they failed, I'm hoping to tell at what stage, and maybe even find evidence of what happened.

/var/log/maillog Seems to have headers of messages, but no indication if they were sent successfully (maybe presence there means they were?). I do see evidence of some cron job notifications that I'm not receiving in this file.

Not finding anything mail related in /var/log/messages or /var/log/system. Although with no emacs it's hard to be at all sure that I've seen what's there accurately (and in their proper relationships).

Where else might I find information? Will I find log entries for successful attempts to send email? For failed attempts to send email? Or is that not being logged?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
As far as I know, it's never been logged. Mail from TrueNAS has always been a bit dodgy.

I personally feel like a Jira ticket to address this shortcoming would be quite appropriate. Ideally, failure to e-mail successfully ought to generate a syslog message and maybe raise an alert in the GUI. This sort of assumes some things that might be difficult to check in practice, however.
 
Joined
Jul 13, 2013
Messages
286
Should I expect manually sending email from the command line with sendmail (the way I've been able to for decades on any Unix-like system) to work? That gives me no error but the email doesn't arrive. (I'm looking for additional ways to test things and find where my config or whatever is wrong. I'm also looking in to putting in a feature request -- when I have a more coherent idea what I actually want.)
 
Joined
Jul 13, 2013
Messages
286
Oh, and should I upgrade to 12 before spending any effort on this? I'm current on the 11.x train but haven't jumped to 12.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
manually sending email from the command line with sendmail (the way I've been able to for decades on any Unix-like system) to work?

Probably not, because this doesn't really work like that, except sorta accidentally in some cases. The mail system actually needs to be configured, and has multiple components (MTA, MSA) in order for Sendmail (capital-S the product formally known as Sendmail) to work correctly.

FreeNAS has put an alternative mailer in place. The base FreeBSD system has long used a wrapper in place of Sendmail, which allows the use of a configured alternative. I believe FreeNAS is using one of the randomly available alternative "simple mailer libraries" to get around the need to do configuration of Sendmail at the MTA and MSA levels, run the Sendmail queue daemon, and the other crap that would normally need to be configured in order for Sendmail to work correctly.

I don't really have the time to dredge through what is actually being done on a FreeNAS system right now, but do expect that while you should be able to hand "sendmail" a message for delivery, it probably isn't going to be doing the things you'd expect of Sendmail or Postfix.
 
Joined
Jul 13, 2013
Messages
286
I'm just looking for an easy way to trigger a test email, something I don't have to wait for like notifications (I could have a cron job that ran every 5 minutes, though, which would I guess be testing from deeper in the stack). For this purpose it needs to conform to the rest of how notification emails get sent, rather than any deep expectations of what giving an email to sendmail does.

I'm certainly sympathetic to avoiding configuring full-blown sendmail if you reasonably can! I ran qmail for a long time, and I have run Postfix, on systems I entirely controlled.
 
Joined
Jul 13, 2013
Messages
286
System->Email->Send Test Mail doesn't work?
Well, it says its starting a job, and says it finished, and the email headers show up in /var/log/maillog. But nothing ever arrives. I've been hoping to find somewhere that explains why not :smile: .

However, by fudging the email configuration I can try some things -- see if I get errors if the server name is wrong, the username on the smtp server is wrong, the password is wrong, stuff like that. If I do when they're wrong and don't when they're right, that sort-of makes me feel better.

ETA: And in fact I get an error box popping up if I change the server name to something invalid, or the username. Which kind of suggests that when I don't get an error it's connecting to the server and delivering the email. Now, it's still not arriving anywhere, but that helps me cut down the region where the problem is happening and hence the region where I should be looking for solutions.

ETA: AND the errors show up in /var/log/maillog, corresponding to when I got the error boxes popping up, too.
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I suggest a little creative use of tcpdump to monitor what might be happening on port 25.
 

jakedn

Cadet
Joined
Mar 22, 2021
Messages
1
Well, it says its starting a job, and says it finished, and the email headers show up in /var/log/maillog. But nothing ever arrives. I've been hoping to find somewhere that explains why not :smile: .

I was wondering if you ever found a solution or cause to this problem.I am having the same issue on truenas-scale-angelfish.
While sending test email Truenas says it was sent and there is an entry in /var/log/maillog :
Sep 24 12:47:25 truenas middlewared[730]: sending mail to reciever@domian.com
Content-Type: multipart/mixed
MIME-Version: 1.0
Subject: TrueNAS truenas.local: Alerts
From: Truescale <sender@domain.com>
To: reciever@domian.com
Date: Sat, 24 Sep 2022 16:47:24 -0000
Message-ID: <truenas-20220924.164724.187750.b'qkI9'@truenas>

There are no errors i can find, but the email is never received.
 
Joined
Jul 13, 2013
Messages
286
I was wondering if you ever found a solution or cause to this problem.I am having the same issue on truenas-scale-angelfish.
While sending test email Truenas says it was sent and there is an entry in /var/log/maillog :
I'm afraid I haven't pursued this aggressively. Still on my list, but I haven't strapped in and really chased it. Maybe yet this year, if I'm lucky.
 
Top