Re: Multidrop retrievers: run filter before sorting ?

Bigaunti - Arcor <[email protected]> Sun, 15 Aug 2021 21:57:27 +0200
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Goodafternoon Charles, thank you for responding so quickly.

Op 15-08-21 07:29, Charles Cazabon schreef:
 > Bigaunti - Arcor <[email protected]> wrote:
 >>
 >> Hope to get hints from you how to change the Getmail (version 5.13) 
script
 >> in /usr/bin/getmail such that a multidrop retriever will run a 
filter before
 >> it starts sorting the emails.
 >> Such that sorting is done based on the header of the filtered result.
 >> And not on the header in the email as it was retrieved.
 >>
 >> Background:
 >
 >
 >> Since long I'm using the multidrop retriever to sort emails based on a
 >> header "X-Original-To:".
 >>
 >> Until my provider was swallowed by some big brother that thought it 
a good
 >> idea (I suspect) to stimulate users to buy their high cost services.
 >> So they removed that header component without any usefull replacement.
 >
 > If I understand you correctly, the original envelope recipient 
address is not
 > recorded in any (stable) header field?  Then you no longer have a
 > multidrop/domain mailbox.  It's just a regular mailbox that has 
"catchall"
 > behaviour.

Correct.

 > That really sucks.  You should complain to them more, or change to 
another
 > provider if you can.

I'm afraid complains ended up in /dev/null.
Loads of other ISP's do exactly the same overhere in Eu.
So i'll stick with this one - these addresses are known all around my 
relations for years.

 >> So I composed some shell script to sort things out.
 >> Which adds such header like "X-Original-To:".
 >> So not removing anything, just adding.
 >
 > So... what does it put in the new X-Original-To: field?  You just 
said the
 > envelope recipient is not recorded, so what can the script be doing to
 > recreate it?

That filter does in the end also just guess who most probably is the 
original/envelop recipient - then adds a "X-Original-To:" header 
containing that guessed recipient.
And return that to Getmail.
It's based on the headers that were in the email at the moment my ISP 
received that email for processing - luckely my ISP does not remove 
those untill today.
After running that filter in the first step, the 
MultidropIMAPSSLRetriever will be able to sort it and forward to Cyrus 
in the second step.

 > The original part of your question:
 >
 >> Hope to get hints from you how to change the Getmail (version 5.13) 
script
 >> in /usr/bin/getmail such that a multidrop retriever will run a 
filter before
 >> it starts sorting the emails.
 >
 > ... is very much a "how do I use a chocolate-covered banana to 
accomplish the
 > integration of European currency systems?" type of question.
 > http://jdebp.info/FGA/put-down-the-chocolate-covered-banana.html
 >
 > I'll reserve the rest of my answer until after you've answered the 
above so I
 > know what actually needs to be done.

Apologies I did not express myself clear.

What I would like Getmail to do: get the email from the provider, run my 
filter, then run the MultidropRetriever using the filter output (instead 
of the original email) to determine the value for the argument 
%(recipient) in the destinations section.
Such that the second step described in the initial request can be 
discarded.

Since I can imagine that there are filters where this behaviour is not 
wanted (at all), most flexible would be to provide an option in the 
filter section ala "run before sorting = true" .
So defaulting to the present behaviour.

 From the docs, and my experiments in the past, I can't recall that the 
MultiGuesser does do this.
So I don't use the MultiGuesser but can't recall anymore why exactly I 
decided in the past to not use MultiGuesser apart from the fact it did 
not provide the desired results.

 > Charles

Hope I did not add to much redundant stuff.

Sincerely and best regards.

Gert