No, leading spaces in message headers are not allowed by the spec.

Nor are multiple From headers.

Multiple addresses in a single from header is technically allowed, but
Google has enforced against it since implementing DMARC nearly a decade ago.

A space in front of a header indicates a header continuation, which means
they are interpreting the next line as a continuation of the From header,
and I guess it happens to parse as another address or two.

And they don't use regular expressions to implement message parsing.  At
least when I looked, the email address parsing code was a bit more lenient
than the rfc, to try and cover emails that were obviously
not generated using rfc compliant software, but should be fairly accurate.
We also had a strict parser to be used in some cases, I don't recall if
it's used for this or not.

Brandon

On Mon, Sep 18, 2023 at 7:56 AM Scott Mutter via mailop <mailop@mailop.org>
wrote:

> We're seeing an increase of errors from Google's mail servers complaining
> about multiple addresses in the From header.  But these messages do not
> have multiple addresses in the From headers or multiple From headers.
>
> Best I can tell, this seems to be caused by additional spaces in some of
> the headers, I suppose the header immediately following the From header.
>
> I'm not really sure who is at fault here.  Are leading spaces in mail
> headers allowed?
>
> Headers formatted as:
>
> From: Name <em...@domain.tld>
>  MIME-Version: 1.0
>
> Generates this multiple addresses in From header error.
>
> Headers formatted as:
>
> From: Name <em...@domain.tld>
> MIME-Version: 1.0
>
> Does not generate this error and messages are sent through.
>
> (In case the formatting of this message does not portray the issue
> correctly, there is a single space before MIME-Version: 1.0 in the message
> that generates this error)
>
> I'm not sure if a leading space in a message header is proper.  But I
> would also kind of lean towards this being a wrong regex being used by
> Google's mail servers to detect multiple addresses in the From header.
>
> Anybody else seeing this or have any insights?
>
> _______________________________________________
> mailop mailing list
> mailop@mailop.org
> https://list.mailop.org/listinfo/mailop
>
_______________________________________________
mailop mailing list
mailop@mailop.org
https://list.mailop.org/listinfo/mailop

Reply via email to