-
-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP8/exim4/linux issue with email headers (Dokuwiki 2022-07-31 Igor) #3733
Comments
Side note: Defining such constants (upgrade-prove) is possible via the This change is not mentioned in the page about the mail() function (https://www.php.net/manual/en/function.mail.php). How did you find it? by testing? or is it also documented? |
Thanks. I found this bug report on drupal's issue tracker which links some issues on the php tracker. Found one more specific pho one but can't find it again right now, will post it later. |
This is the bug report on php stating that php's mail function was changed and now uses CRLF instead of LF. The effect of the issue described in it is different from the resulting mail in dokuwiki, bit it helped figuring out where to look for a workaround: Took me various testing and googling but I understand what's happening now and how the email ended up the way it does. I couldn't figure out where the single space indentations were coming from until I found the explanation in the exim documentation https://www.exim.org/exim-html-current/doc/html/spec_html/ch-message_processing.html section 2. This results in the following explanation: Changing the define statement from the bare LF to CRLF makes the line endings consistent throughout the email passed to exim and all is fine. |
I've upgraded PHP from 7.4 to 8.1 on a Debian 10 linux system with exim4 4.94.2 running Dokuwiki 2022-07-31 Igor and email notifications were not sent out. It was working perfectly fine before the php upgrade.
The email system complained that "A message that you sent contained no recipient addresses, and therefore no delivery could be attempted." even though bcc was used.
The email header looked like this:
Note the spaces in front of several headers including the BCC line.
After investigating it turned out that this is related to the change of the mail() function in php8 to always use CRLF ("\r\n") in email headers instead of just the typical LF ("\n") on linux systems.
I found the solution in inc/mail.php by changing the MAILHEADER_EOL definition at the top from "\n" to "\r\n".
This might not be the best place to change this and I do not know how other mail systems or operating systems would react to this, but might be useful to someone and preparing a proper adjustment probably based on PHP version and operating system.
The text was updated successfully, but these errors were encountered: