Setting up MediaWiki in a 14.3R jail with default `dma` mail config + `SMART_HOST`` set to host system (also 14.3R) running sendmail.
I couldn't get email to send. dma -> sendmail (SMTP) was rejecting with:
and leaving the message stuck in dma's queue.
Debugging with a command-line PHP (8.3.27) call to mail():
and getting a tcpdump on the "wire" between
i.e. The end of the message string is followed by: <CR/LF><CR><CR/LF>.<CR/LF>
I couldn't find any useful information about a likely cause or how to fix and eventually just tried toggling PHP's configuration item:
mail.mixed_lf_and_crlf bool
Allows reverting the line separator for email headers and message bodies to LF (Line Feed), mimicking the non-compliant behavior of PHP 7. It is provided as a compatibility measure for certain non-compliant Mail Transfer Agents (MTAs) that fail to correctly process CRLF (Carriage Return + Line Feed) as a line separator in email headers and message content.
Which fixed (bodged?) it.
Curiously this is actually being done as a migration of MediaWiki from the host system to the jail. The host system is also (currently) running PHP 8.3.27 - having had numerous previous versions including prior to 8.2.4 and it has never been a problem there with PHP sending emails via sendmail, despite that PHP option reportedly defaulting to "Off".
I haven't looked into it any further yet but I could guess that PHP could be mis-handling its submission via sendmail (i.e. not SMTP) and
Anyway, not too worried since I have found a work-around, but I'm bothered by not having been able to find any extant reports of this. I'm wondering if anyone has any further insights to offer on this?
I couldn't get email to send. dma -> sendmail (SMTP) was rejecting with:
421 4.5.0 Bare carriage return (CR) not allowedand leaving the message stuck in dma's queue.
Debugging with a command-line PHP (8.3.27) call to mail():
jexec mwjail php -r 'mail("me","Test Subject","Test Message");'and getting a tcpdump on the "wire" between
dma and sendmail there is a stray CR at the end of the "Test Message" string: 0d0a 0d0d 0a2e 0d0ai.e. The end of the message string is followed by: <CR/LF><CR><CR/LF>.<CR/LF>
I couldn't find any useful information about a likely cause or how to fix and eventually just tried toggling PHP's configuration item:
| mail.mixed_lf_and_crlf | "0" | INI_SYSTEM INI_PERDIR | Added in PHP 8.2.4 |
Allows reverting the line separator for email headers and message bodies to LF (Line Feed), mimicking the non-compliant behavior of PHP 7. It is provided as a compatibility measure for certain non-compliant Mail Transfer Agents (MTAs) that fail to correctly process CRLF (Carriage Return + Line Feed) as a line separator in email headers and message content.
Which fixed (bodged?) it.
Curiously this is actually being done as a migration of MediaWiki from the host system to the jail. The host system is also (currently) running PHP 8.3.27 - having had numerous previous versions including prior to 8.2.4 and it has never been a problem there with PHP sending emails via sendmail, despite that PHP option reportedly defaulting to "Off".
I haven't looked into it any further yet but I could guess that PHP could be mis-handling its submission via sendmail (i.e. not SMTP) and
sendmail(8) is being more tolerant? (sendmail "tolerant"? Maybe not?)Anyway, not too worried since I have found a work-around, but I'm bothered by not having been able to find any extant reports of this. I'm wondering if anyone has any further insights to offer on this?