Re: How getmail deals with delivery errors and with bounce e-mails

Charles Cazabon <[email protected]> Thu, 5 Nov 2020 14:11:58 -0600
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Langenxx Feld <[email protected]> wrote:
> 
> > getmail should already be exiting nonzero when a delivery error happens.
> > Did you already test this and find differently?
> 
> To be honest, I do not know anymore where I got that idea from, [...] and
> yet nobody has challenged that assumption.

Well, I'm challenging it here.  I don't usually go looking for statements of
the "getmail is not doing what it obviously has always done" sort.

> Have you perhaps looked at the code since then, and are now convinced that
> the exit code will be non-zero?

Yes, but I don't need to.  As I say, getmail has always done that, for the
last 20 years.

> I cannot actually test it now, but I will get back to it soon enough
> (hopefully). I am also a little impeded because I do not know Python.

An easy way to test it is to configure MDA_external and use /bin/false as the
MDA.

I will add a note about exit codes to the man page; thanks for the suggestion.

> You could then explain what you meant by "nonfatal error",

Well, that's a term that defines itself.  Fatal errors kill the program
immediately (hence, "fatal"); nonfatal errors let the program continue after
some operation fails.

> Furthermore, I stated in my very first e-mail: "I have seen a failing e-mail
> in a different scenario stopping the processing of all other e-mails
> altogether."

As soon as you said this, I was 99% sure of what you ran into.

> [retriever]
> type = MultidropIMAPSSLRetriever
> envelope_recipient = X-Original-To:1
> 
> One or both copies of that single mail without X-Original-To made getmail
> stop abruptly. Is that what you would consider a fatal error?

That is *exactly* what I thought.  Remember I mentioned that getmail has code
specifically to catch the case of someone using a Multidrop retriever, but the
mail service provider doesn't correctly record the message envelope?

That's exactly what you hit.  The configured envelope recipient header field
that you specified did not exist in the message.  getmail aborts (fatal error)
because to do otherwise would mean delivering the email potentially to the
wrong user or mailbox.

No mail should be able to get into your domain mailbox without the specific
envelope header fields that you specify.  Your provider, sadly, is not doing
this correctly.  Perhaps you can work around this by just not sending mail
directly to the catchall address; but if anyone else ever sends mail to that
address, it will fail again.

I suggest you switch to a provider that knows how to do domain mailbox service
properly :)

Regarding deleted messages - if you had deleted messages from the IMAP mailbox
with another mail client, *and* had expunged that mailbox, and getmail then
saw the deleted messages the *next time* it connected, I would say you've
found a bug in your IMAP provider's setup.  You should report it to them.

If you hadn't explicitly expunged the mailbox, or if getmail was already
connected before you deleted them with another client, then it can be valid
for those messages to still be seen by other connected clients.

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------