I’m not a mail expert, but after the update from 24.10.1 to 24.10.2, scripts sending email to me stopped working. For example, I have a script that run nightly backup up the TrueNas config file and then emailing me to let me know whether it succeeded and if so, which versions of the saved config files were deleted. This has worked for years on both Core and now on Scale till the latest upgrade.
After some investigation I noticed that on the 24.10.2 system, sendmail was linked to exim4, while on the 24.10.1 system sendmail was pointing to /etc/alternatives/sendmail.
The email settings within Settings->General Settings->EMail are identical on both my prod and test systems and when I “Send Test Mail” from here, both test messages get sent and recieved.
However, when I send an email from within my script(s) using the sendmail command, only the 24.10.1 systems messages get sent, while the 24.10.2 systems messages get stuck in the queue as “frozen”.
I then re-checked the release notes for 24.10.2 and could find no mention of any changes in the mail handling system.
Does anybody know what’s going on and more importantly, how to fix this!
In this long thread there are some way to call new email function, but honestly at the time we struggled a bit… but If can help you too, i have made a small python to achieve what sendemail does before, here the link: oxyde1989/standalone-tn-send-email: stand alone truenas send email
What I don’t understand with this problem, is that mail works fine from the TrueNAS web interface. What I mean by that is that if I go into System->General Settings->Email->Settings and then define my email to go to an external smtp server on port 587 with a username and password and STARTTLS security. Then I click on the “Send Test Mail”, I get the test mail message every time. Why does mail work here and not within a script using sendmail or exim4 command.
web interface not using anymore sendmail function, has been removed due to security concerns.
I understand is a really long post, but most answer (and some way to call actual function via midclt ) are in the post i mention above