TLDR: SMTP header is being incorrectly rewritten and trying to find solution.
Ubuntu Version: 26.04 LTS Server
Desktop Environment (if applicable): N/A
I have a fully updated version of Ubuntu Server and am having issues with system email notifications, specifically cron STDERR/STDOUT. I have the latest versions of mutt & msmtp installed and configured (Postfix/Exim is overkill for my situation). When sending an email from CLI (via mutt or mail, which mail is symlinked to mutt), the email is received with proper headers. However, when I receive an email from the cron daemon (I have crontab configured with proper MAILTO=), the email header has the âFromâ as âCron Daemon <root@{mailhost}>â where mailhost is my webhost/email providerâNOT the local server in my house running the cron job. I have /etc/aliases configured with the correct âfromâ address for sendmail (symlinked to msmtp) to use for cron yet it appears to come from my webhostâs cron daemon, not mine. I have two other Ubuntu servers with similar setup that donât have this issue, though they are 24.04.4 not latest LTS. I am truly perplexed that the header is rewritten before it even reaches the email host (NOTE: the âfromâ shows the webhost/mail host but the correct âreply toâ in the header in the first transaction).
Iâve tried wrapper scripts to replace low-level cron email output but they donât work. As previously stated, no issues with sending direct from CLI. Just canât understand how/why header is rewritten with webhost/email provider when cron is sending STDERR/STDOUT from a local server (I sort/search email based on cron output).
Example header:
Received: from {ISP name/IP}:49260 helo=localhost)
by {webhost/email provider} with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
(Exim 4.99.5)
(envelope-from <{correct from email, as in /etc/aliases}>)
id 1wsVOv-0000000DsVM-2wV1
for {correct delivery email};
Fri, 07 Aug 2026 20:59:01 -0400
Date: Fri, 07 Aug 2026 18:59:01 -0600
Message-ID: <2e664fc05740ae513329dab3b80ba915@{my domain}>
From: root@{webhost/email provider} (Cron Daemon)
To: {correct delivery email}
Subject: Cron <root@{local server hostname}> /root/scripts/cron_test.sh
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <MAILTO={correct email>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
+++ cron test completed +++
While this isnât a significant issue, it does present some challanges as the âFromâ sorting gets mixed up and/or combined.
Thanks in advance for any insight!