[Mailman-Users] I need to get "Sender:" address
msapiro at value.net
Fri Sep 29 20:41:40 CEST 2006
Rob Jackson wrote:
>I have messages coming from a Gatewayed Message board to mailman. There is
>an extra field To: field and a Sender: field and I need to get the Sender
>I have tried modifying the SENDER_HEADERS to
>('sender','from',None,'reply-to'), so sender is before from, but it still
>grabs the "From" even if "Sender exists."
Which headers are searched and in which order depends on several things
including context. You probably need to set USE_ENVELOPE_SENDER to Yes
Here are the details:
There are two Mailman.Message.Message methods for getting the sender.
They are get_sender() and get_senders().
If USE_ENVELOPE_SENDER is Yes or True, get_sender() returns the first
address found from the headers Sender:, From:, and the unixfrom or
envelope sender. Otherwise the search order is From:, Sender:,
OTOH, get_senders() returns a list of all the addresses found in all
the headers listed in SENDER_HEADERS.
Thus, changing SENDER_HEADERS has no effect on the address returned by
get_sender() and reordering SENDER_HEADERS only affects the order of
the addresses returned by get_senders().
The distinction is important, because in some contexts (e.g.
determining whether the sender is a list member), get_senders() is
used to get a list of addresses, whereas in other contexts (e.g.
determining if the sender is in *_these_nonmembers), get_sender() is
used to get a single address.
Mark Sapiro <msapiro at value.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users