Skip to main content
Topic: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted (Read 1604 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #15

Is that something that would be mentioned in phpinfo()? I don't run it from my VPS but from shared hosting (Hetzner). But it's Linux 4.19 with PHP 8.1.4.

Quote from: Spuds – If I change it to CRLF the mail tests fail in our github actions testbed which is Ubuntu 20.04, so at least Ubuntu/Debian native sendmail expect only LF. 
Fails in which way? Sending a message locally won't care if it's all \n.

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #16

CRLF is the rfc standard and Debian follows that for its default mail packages. Only one I know which doesn’t conform well is qmail, but that’s a configuration option from memory.

You can however set the headers as an array from PHP 7.2 so it’s not decided by you but PHP itself, If that’s a benefit or not I don’t know…

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #17

In 2.0 the headers are in an [] (but then imploded on the break style) but I can change that !

You might be able to see what OS is running from the ACP Support and Credits section.  Sometimes the OS infor will be in the Version Information area, all depends.  You can also get to your PHP info from there which will show some mail settings such as where the sendmail program is located etc.

Where I was going with the LF was that if PHP is using sendmail I would have thought that the input would be the same as if I was using sendmail from the nix command line, at which point I would not be using CRLF.

Looks like there was some discussion about this over the years as well
This on the docs changing https://bugs.php.net/bug.php?id=15841

And this one on the function changing in php8 https://bugs.php.net/bug.php?id=81158 specifically https://github.com/php/php-src/commit/6983ae751cd301886c966b84367fc7aaa1273b2d#diff-c6922cd89f6f75912eb377833ca1eddb7dd41de088be821024b8a0e340fed3df

So looks like php8+ should get CRLF and perhaps older versions LF?

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #18

I already had issues with 7.1 and 1.0.10, in retrospect most likely on account of Elk supplying \n instead of \r\n like it should. I just never quite got around to investigating it properly sine I was hoping 1.1.x would magically fix the problem.

But it may well be that older PHP is just a broken unusable mess period. Anyway, if your CI thinks you should do that it's probably at least half right. ;)

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #19

That comes across a tad bit mocking, no matter, I am trying to figure out why things were that way for many years.

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #20

Quote from: Spuds – That comes across a tad bit mocking, no matter, I am trying to figure out why things were that way for many years.

"Grandfather" finally died?  :P

[Imagine my surprise when I discovered DOS still supported the old (undocumented in DOS) CP/m "ERA" command... until DOS 6.1, at which point it just no longer did... ]
Last Edit: April 01, 2022, 07:30:11 am by Steeley

// Deep inside every dilemma lies a solution that involves explosives //

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #21

Quote from: Spuds – That comes across a tad bit mocking, no matter, I am trying to figure out why things were that way for many years.
If you mean of PHP, reading it now I see it was too mean-spirited, but definitely not intended of Elk if that's what you mean! ;)

But anyway, I think PHP is pretty good too.

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #22

Were you able to see what your PHP sendmail_path setting is? I'd really like to know what that is and from which MTA its from.

On my Ubuntu server its /usr/sbin/sendmail -t -i and the version of sendmail at that location is the version put in place by Postfix which is the MTA I have installed.   

Depending on what MTA is in use, the sendmail command would be the CLI interface to Exim, Postfix, Qmail I guess it could be actual Sendmail (I've only used Postfix or Exim).  All the MTA's are required to provide a sendmail interface, even if they do not support all of the original sendmail options.  The man page for sendmail on my system simply lists several of the options as ignored.

Where I get torn on this is that if I were to use sendmail from the *nix CLI I would not be entering CRLF, not even if I were using predefined header files.  I did find this in the Exim man page which explains what they do, which indicates they do lots of manipulations to get things consistent. 

Quote2. Line endings
RFC 2821 specifies that CRLF (two characters: carriage-return, followed by linefeed) is the line ending for messages transmitted over the Internet using SMTP over TCP/IP. However, within individual operating systems, different conventions are used. For example, Unix-like systems use just LF, but others use CRLF or just CR.

Exim was designed for Unix-like systems, and internally, it stores messages using the system’s convention of a single LF as a line terminator. When receiving a message, all line endings are translated to this standard format. Originally, it was thought that programs that passed messages directly to an MTA within an operating system would use that system’s convention. Experience has shown that this is not the case; for example, there are Unix applications that use CRLF in this circumstance. For this reason, and for compatibility with other MTAs, the way Exim handles line endings for all messages is now as follows:

LF not preceded by CR is treated as a line ending.

CR is treated as a line ending; if it is immediately followed by LF, the LF is ignored.

The sequence “CR, dot, CR” does not terminate an incoming SMTP message, nor a local message in the state where a line containing only a dot is a terminator.

If a bare CR is encountered within a header line, an extra space is added after the line terminator so as not to end the header line. The reasoning behind this is that bare CRs in header lines are most likely either to be mistakes, or people trying to play silly games.

If the first header line received in a message ends with CRLF, a subsequent bare LF in a header line is treated in the same way as a bare CR in a header line.

I think for *nix it seems fine to use LF or CRLF to either Exif or Postfix "sendmail" interfaces but it needs to be consistent. Qmail seems to only accept LF. 

PHP 8 looks to only use CRLF, if it adds headers or if you pass it an array (which seems to indicate that you can't use the array syntax if Qmail is the MTA)

Confused yet, good, me too:smile:It feels like LF, even although not rfc2822 proper, provided, at least at some point,  the widest *nix support to sendmail which in turn sends proper rfc2822 syntax to the MTA.

Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #23

Code: [Select]
mail.add_x_header	Off	Off
mail.force_extra_parameters no value no value
mail.log no value no value

Code: [Select]
sendmail_from	no value	no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i

Code: [Select]
Path to sendmail 	/usr/sbin/sendmail -t -i 


Re: Gmail: multiple addresses in From:n550 5.7.1 header are not accepted

Reply #24

Thank you for that, interesting as well since its almost mirrors what I have. 

Are you able to see what MTA your server has installed?   Just trying to narrow things down.  On my quick test setup ubuntu 20.04 w/postfix either /n or /r/n worked with PHP 7.4 and PHP 8.0 (I'm delinquent on 8.1 testing)  We can assume you are not using Qmail since that is the only one that, according to the php site, requires /n ... that should leave (for the most part) postfix, exim or sendmail.  If you don't have shell access it might show your MTA in outbound email headers.

I don't mind using just CRLF in 2.0 and see how it goes, but I'm hesitant to make a 1.1.9 change.

ETA: Answered my own question, looked back at the one you posted and it says (Exim 4.92.3) Now to set aside some time to setup a test server with that MTA