welcomelist_from_spf

"otto.cooper" <[email protected]> Fri, 12 Dec 2025 20:18:34 +0000
Newsgroups gmane.mail.spam.spamassassin.general
Message-ID <3a5ZBO9UUTkDGm0HiMdiaH05RnYAFNd9OERcE1FAv7-rdkpMJCnlfIJdRjIOpvx57hjrS8u6Uxyea0Vha7oBYzksTtQdjVBYbUwp5y1fqv8=@proton.me>
Hello, 

I encountered the following problem when using welcomelist_from_spf.

The comand "spamassassin -t --debug <test.eml" shows that the rule fails, because it is not using the envelope-from header.

This is how the header is generated and used locally.

The envelope-from header is not generated by default, so I added the following rule in postfix's sender_access:

/(.*)/  prepend X-Envelope-From: <$1>

As a result, the header is added after the last Received.

Additionally, a sub-header envelope-from is added as part of Received-SPF, immediately after the last Received.

Finally, in SpamAssassin, I set the following variables:

> envelope_sender_header X-Envelope-From
> always_trust_envelope_sender 1

>loadplugin Mail::SpamAssassin::Plugin::SPF
>spf_timeout 5
>ignore_received_spf_header 0
>use_newest_received_spf_header 0

When running the debugger, this is what I see.

> [...] dbg: message: X-Envelope-From header found after 1 or more Received lines, cannot trust envelope-from

> [...] dbg: spf: EnvelopeFrom not found in first external Received header
> [...] dbg: spf: EnvelopeFrom header not found
> [...] dbg: spf: cannot get EnvelopeFrom, cannot use SPF by DNS

The test.eml contains a single Received-SPF.

What is the problem?

SA is ignoring envelope_sender_header, and looking for EnvelopeFrom instead of X-Envelope-From.

SA is ignoring the envelope-from included in the Received-SPF header.

If I rename X-Envelope-From to EnvelopeFrom in test.eml, the debugger shows that the header is found and used.

I have a rule that says welcomelist_from_spf *@example.com from test.eml, but the resulting score is still high. 

I used X-Envelope-From in a few postfix rules, and I can change it to EnvelopeFrom if needed. 
However, the envelope from is the address used in the Return-Path header, which is included 
by default and happens to be the topmost header, so no special header ought to be added in the first place.