mails not delivered since 2.18 due to invalid "to:" format
Affected version
Version: %2.18.1
Platform: Nginx
Summary
When llng sends a password reset mail, the mail is not reveived due to an invalid "to:" field.
For example:
To: david.coutadeur@worteks.com <david.coutadeur@worteks.com>
When received by smtp.office365.com, this mail is displayed as:
To: david.coutadeur@
BCC: <david.coutadeur@worteks.com>
Consequence: the mail is received by the user, because of the BCC field (I don't know how this field is added though), but the admin also receives a "non-delivery" mail.
Logs
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.509 (Entity 5.509)
From: admin@customer.org
To: david.coutadeur@worteks.com <david.coutadeur@worteks.com>
Subject: =?utf-8?B?W0N1c3RvbWVyXSBSw6lpbml0aWFsaXNhdGlvbiBkZSBtb3QgZGUgcGFzc2U=?=
Date: Thu, 25 Jan 2024 14:45:22 +0000
Bonjour David Coutadeur,
Cliquez ici pour réinitialiser votre mot de passe :
https://auth.demo.fusioniam.org/resetpwd?mail_token=9683247caf1aaaf29051a7ff0d8157b3559d60743f8e83429c3496b60c8daa64&skin=bootstrap
Pour tout problème d’authentification merci d’écrire à admin@customer.org';
Possible fixes
The problem seems to be linked to: #2990 (closed) and especially 962effa8
According to the this RFC: https://datatracker.ietf.org/doc/html/rfc822#section-3.1.1 the following syntax should be used:
To: "david.coutadeur@worteks.com" <david.coutadeur@worteks.com>
If you are ok @guimard, I propose to patch this into:
if ($mail =~ /^\S+\@\S+$/) {
$mail = "\"$mail\" <$mail>";
}
Edited by dcoutadeur dcoutadeur