Cannot send email after upgrade to Scale 25

Hello, after I upgraded from Core 13.0 to Scale 25.10.1 (Goldeye) I lost ability to send emails which is pretty bad for notifications (hardware failures, pool anomalies, etc).

I am reusing the config from the previous install (13.0) and made sure the email settings were correct. I even reentered them to be sure.

When I try to send an email via GUI I get

“[EFAULT] Failed to send email: ‘str’ object has no attribute ‘decode’”.

I am sending emails via a local SMTP relay running on port 8025.

Middleware logs show:

root@srv-nas01[~]# tail -f /var/log/middlewared.log | grep -i -A 10 "mail"

[2026/02/22 12:49:05] (WARNING) MailService.send_raw():312 - Failed to send email @cee:{"TNLOG": {"exception": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/mail.py\", line 288, in send_raw\n from_addr if isinstance(from_addr, str) else from_addr.encode().decode(),\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'str' object has no attribute 'decode'", "type": "PYTHON_EXCEPTION", "time": "2026-02-22 17:49:05.583575"}}

[2026/02/22 12:49:05] (ERROR) middlewared.job.run():540 - Job > failed: CallError("Failed to send email: 'str' object has no attribute 'decode'")

[2026/02/22 12:51:46] (ERROR) middlewared.job.run():540 - Job > failed: CallError('Failed to send email: [Errno 111] Connection refused')

[2026/02/22 12:52:01] (WARNING) MailService.send_raw():312 - Failed to send email @cee:{"TNLOG": {"exception": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/mail.py\", line 288, in send_raw\n from_addr if isinstance(from_addr, str) else from_addr.encode().decode(),\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'str' object has no attribute 'decode'", "type": "PYTHON_EXCEPTION", "time": "2026-02-22 17:52:01.656595"}}

[2026/02/22 12:52:01] (ERROR) middlewared.job.run():540 - Job > failed: CallError("Failed to send email: 'str' object has no attribute 'decode'")

[2026/02/22 12:54:47] (WARNING) MailService.send_raw():312 - Failed to send email @cee:{"TNLOG": {"exception": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/mail.py\", line 288, in send_raw\n from_addr if isinstance(from_addr, str) else from_addr.encode().decode(),\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'str' object has no attribute 'decode'", "type": "PYTHON_EXCEPTION", "time": "2026-02-22 17:54:47.933155"}}

[2026/02/22 12:54:53] (ERROR) middlewared.job.run():540 - Job > failed: CallError("Failed to send email: 'str' object has no attribute 'decode'")

[2026/02/22 12:58:40] (WARNING) MailService.send_raw():312 - Failed to send email @cee:{"TNLOG": {"exception": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/mail.py\", line 288, in send_raw\n from_addr if isinstance(from_addr, str) else from_addr.encode().decode(),\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'str' object has no attribute 'decode'", "type":

Searching the bugtracker I have the impression that this issue was fixed in Goldeye but apparently not.

Seriously, nobody? Am I the only one with issues ?

I just installed multi_report.sh but of course it cant send email notifications because of this issue.

multi_report.sh not rely on the built-in sendemail, but on a custom script that use the same built-in config… if both are failing, is reasonable to think that something odd is happening config side, despite you save the config again.
From shell, if you cd into the multi report folder, you will see the sendemail.py: try run it with the --test_mode arg, like

python3 sendemail.py --test_mode

and see what happen. Let’s see if something different is catch by the script that can help resolve the issue

Hello!

OK I ran the script in test mode:

root@srv-nas01[/mnt/zpool/scripts/multi_report]# python3 sendemail.py --test_mode
Activating test mode
{“version”: “1.80”, “error”: true, “detail”: “KO: (450, b’failed to send notification’)”, “logfile”: “/mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt”, “total_attach”: 1, “ok_attach”: 0}
root@srv-nas01[/mnt/zpool/scripts/multi_report]# cat /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt

TEST MODE ON

Script Version: 1.80

Entering template render. Scale/Core switch needed
search for test_message template on REPO
reading template
templates loaded
applying iteration
trying to expands iterated vars
nothing to iterate found
File /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt successfully generated
13 totals file log
1 totals attachment to handle
trying read mail.config
read mail.config successfully
Switching for the right provider
** SMTP Version **
From found
parsing smtp config
switch from classic send and bulk email
mail hmtl provided
parsing html content
body can’t be a file, too much long
trying apply a template
no template provided
start parsing headers
parsing data from config and override options
using mr-config fromname-email
generate a message ID using alertsrv
alertsrv not a valid address, tryng on srv-nas01@tuxdomain
domain: tuxdomain
uuid: 2026_03_01_10_06_02_85997c572a9-a5ba-468e-9f1f-187e4a0c7cda
messageid: 2026_03_01_10_06_02_85997c572a9-a5ba-468e-9f1f-187e4a0c7cda@tuxdomain
check for attachements…
attachments found
symlink verification for /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt pass
size verification for /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt pass
blacklist verification for /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt pass
attachment valid /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt
Found 1 valid files
standard attachment mode
trying to parse the correct mimetype for /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt
result: text/plain | None
mimetype correctly splitted
attachment /mnt/zpool/scripts/multi_report/sendemail_log/20260301_100602.txt done
1 ok attachments
get hostname
hostname retrieved: srv-nas01.tuxdomain
tryng retrieving if more recipient are set
establing connection based on security level set on TN: PLAIN
entered PLAIN path
adding ehlo to the message
entering credentials
sending PLAIN email
An unexpected error has occured: (450, b’failed to send notification’)
KO: (450, b’failed to send notification’)

Please note: “alertsrv” is the pre-configured user on my SMTP relay (using mailrise which forwards the email to my proton email).

I know now that the multireport script does not use truenas’s settings but here’s my config anyways because the test mode above mentioned user “alertsrv” which I do not remember entering when I ran the config option of multireport… So perhaps after all the multireport script does use some data from truenas’s config?

  • Send mail method: SMTP
  • From email: root@srv-nas01.tuxdomain
  • Outgoing Mail server: support.tuxdomain
  • Mail server port: 8025
  • Security: PLAIN (no encryption)
  • SMTP Auth: CHECKED
  • Username: alertsrv
  • Password: **********

When I press “Send Test Email” → [EFAULT] Failed to send email: ‘str’ object has no attribute ‘decode’

Thanks for the details!
I think that both TN and sendemail are receiving the same error, but somehow TN try to decode the already string from mailrise and raise that useless exception.

Now we have the real error:

An unexpected error has occured: (450, b’failed to send notification’)
KO: (450, b’failed to send notification’)

and to me this really seems that mailrise received the email, but can’t somehow process It.
Are you running mailrise in a docker container in the same machine? Can you see the logs inside the container?

For that instead

I probably was not clear in the previous post, what i mean was that MR not rely on the sending builtin email functionality of TN but on the sendemail.py, though sendemail.py rely on the TN builtin email config :smile: so yes the configuration Is “shared”. It also give more options like overrides, as you see in the logs (just to mention if you decide to use the sendemail stand alone for other purpose)

EDIT:
sorry for the edit, i realized another things that yesterday i didn’t notice:

using mr-config fromname-email
generate a message ID using alertsrv
alertsrv not a valid address, tryng on srv-nas01@tuxdomain
domain: tuxdomain

did you put srv-nas01@tuxdomain as from in the mr-config? Is it correct?
Just for be sure: rename momentary the multi_report_config.txt like __multi_report_config.txt and try again the test mode, just to be sure that is not only that that block mailrise to send the notification (at least sendemail side)

Check “From Name” in System/General Settings/Email Options. If the field is empty, the error shown in your log may occur.

Hello guys, OK I managed to get further. There was indeed a problem on mailrise running on a remote host, somehow the config file got overwritten during a backup which it was not supposed to happen… Anyways now from Truenas’s webui I can send emails using the general config > email > send test email. Works flawlessly.

However multi_report.sh still chokes… I did many hours of troubleshooting and the issue is on mailrise’s side. Apprise seems to be having troubles with the complexity of the email generated with multi_report.sh…. stripping the attachments (which required short-circuiting the script and the python email helper) worked.

I am not sure why the script doesn’t have a “flatten” / ”legacy” switch which would send a simple email with no attachment but thats a problem on mailrise’s side so I wont complain about the multi-report script.

Sorry for late response, i missed the thread :smile:

Btw, you should give a look into multi report config (maybe use the hub, via GitHub), because there are some way to suppress certain attachment, but im not sure if all are switchable.
Sendemail Is capable to zip all the attachments, maybe you can try this way just for the sake of test It (but you will need to manually edit the sendemail invocation into multi report because this option Is not exposed).

I’m instead pretty surprised to read about “complexity” of the email, because the body Is just plain online HTML (either the disk layout part).