Friendica 2022.10 seems to be sending malformed email notifications
@Friendica Support
I am the system administrator of the Friendica node at talkabout.cf, and have just updated the node to version 2022.10, along with a system upgrade to Ubuntu 22.04 and an updated web control panel. I just received several email notifications that were garbled in my inbox. I was able to trace the problem to some header lines that have an extra space at the beginning of each line. I am including these redacted headers below. I also leave a couple of lines above and below intact to make these extra leading spaces visible.
The message ID of course is added by the mail transfer agent before the message is delivered, but I left that header because it is immediately above the Subject: header, which does not contain a leading space. I did resend the message by copying and pasting the garbled source message into a text editor, removing the leading space from each line and copying and pasting it back into a direct connection to my local SMTP server, sending the message to myself, and I received the correctly decoded message. Did I find a bug in the latest 2022.10 Friendica code, or did something go wrong with the upgrades that I performed prior to the update that somehow didn't affect anything other than these mail headers?
I am the system administrator of the Friendica node at talkabout.cf, and have just updated the node to version 2022.10, along with a system upgrade to Ubuntu 22.04 and an updated web control panel. I just received several email notifications that were garbled in my inbox. I was able to trace the problem to some header lines that have an extra space at the beginning of each line. I am including these redacted headers below. I also leave a couple of lines above and below intact to make these extra leading spaces visible.
Subject: [Friendica:Notify] Name Redacted tagged you (kyle@talkabout.cf)
Precedence: list
X-Friendica-Host: talkabout.cf
X-Friendica-Platform: Friendica
X-Friendica-Version: 2022.10
List-ID: <notification.talkabout.cf>
List-Archive: <https://talkabout.cf/notifications/system>
X-Friendica-Account: <kyle@talkabout.cf>
References: <RedactedHexID@email.server>
In-Reply-To: <RedactedHexID@email.server>
From: Talkabout Federated Social Network | Powered by Friendica <notify@talkabout.cf>
Reply-To: Talkabout Federated Social Network | Powered by Friendica <notify@talkabout.cf>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="2-189687198-581818022=:18767"
Message-Id: <RedactedMessageIDSuppliedByServer@email.server>
From: "redacted@email.address" <notify@talkabout.cf>
Date: Sun, 06 Nov 2022 14:33:24 +0100
The message ID of course is added by the mail transfer agent before the message is delivered, but I left that header because it is immediately above the Subject: header, which does not contain a leading space. I did resend the message by copying and pasting the garbled source message into a text editor, removing the leading space from each line and copying and pasting it back into a direct connection to my local SMTP server, sending the message to myself, and I received the correctly decoded message. Did I find a bug in the latest 2022.10 Friendica code, or did something go wrong with the upgrades that I performed prior to the update that somehow didn't affect anything other than these mail headers?
Hypolite Petovan
in reply to Kyle π πΆ • • •Thank you for the report. These headers are handled by the third-party library that we are using, PHPMailer. We've been using it for several years now, and you are the first one to report garbled emails so I'm not sure what to say. We don't have direct control over the output and we don't have any insight about your own system. As a result there's little we can do to troubleshoot and potentially fix this issue on either end.
It sounds like there's an overly zealous mail software somewhere as no other admin has had this issue before and we haven't changed the sending software.
Hypolite Petovan
in reply to Hypolite Petovan • • •Ah wait, if you aren't using the phpmailer addon this isn't entirely accurate. We also are using the base
mail()
PHP function which relies on the current MTA of the server, eithersendmail
orpostfix
, etc...What is your configuration in this regard?
Kyle π πΆ
in reply to Kyle π πΆ • • •Kyle π πΆ
in reply to Kyle π πΆ • • •Hypolite Petovan
in reply to Kyle π πΆ • • •mail()
call in Friendica, so I feel like it has to do with Exim. Would you be able to temporarily switch to Postfix to perform a test?Kyle π πΆ
in reply to Hypolite Petovan • • •Unfortunately I think it may be non-trivial to replace Exim with Postfix on this server, as it is currently running several production mail accounts across multiple domains.
Incidentally, I used the interactive php shell to send one such garbled message back through the php mail function after rewriting the message body to escape the new line characters and rewriting the headers to remove leading spaces and add \r\n to the end of each line as I read in a guide on how to use the function. The message came to my inbox legible and ungarbled. I used the message I'm replying to here, which is already on the public forum, so I won't have to redact anything other than my own email address and my mail server domain. In case it helps, this is how I called the function.
Peter VΓ‘gner
in reply to Kyle π πΆ • •Email messages that I am getting into my inbox don't suffer from this.
I can't think of how exim would garble the headers though.
Friendica Support reshared this.
Peter VΓ‘gner
in reply to Kyle π πΆ • •Are you using other addons that might affect generating or sending emails?
Friendica Support reshared this.
Kyle π πΆ
in reply to Peter VΓ‘gner • • •Friendica Support reshared this.
Steffen K9 π°
in reply to Kyle π πΆ • • •Just checked the headers of my notification mails. They look ok.
I'm using the phpmailer add-on and my own mail server with postfix.
Kyle π πΆ
in reply to Kyle π πΆ • • •Friendica Support reshared this.
Hypolite Petovan
in reply to Kyle π πΆ • • •\n
by\r\n
insrc/Object/Email.php
on lines 140 and 143 and try again, see if it changes anything?Friendica Support reshared this.
Kyle π πΆ
in reply to Hypolite Petovan • • •Friendica Support reshared this.
Hypolite Petovan
in reply to Kyle π πΆ • • •Friendica Support reshared this.
Hypolite Petovan
in reply to Hypolite Petovan • • •@Kyle π πΆ See github.com/friendica/friendicaβ¦ there's an additional file to edit at
src/Util/Emailer.php
lines 166 through 168 with the same edit.And then you should be ok. The big question is whether everyone else will still be ok. π
Friendica Support reshared this.
Kyle π πΆ
in reply to Hypolite Petovan • • •Hypolite Petovan likes this.
Friendica Support reshared this.
Hypolite Petovan
in reply to Kyle π πΆ • • •Kyle π πΆ likes this.
Friendica Support reshared this.