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

Charles Cazabon <[email protected]> Thu, 5 Nov 2020 15:03:40 -0600
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Langenxx Feld <[email protected]> wrote:
> 
> > getmail aborts (fatal error) because to do otherwise would mean delivering
> > the email potentially to the wrong user or mailbox.
> 
> I understand. I am aware that it may not be possible to get a 100 %
> watertight solution.

Actually, with good domain mailbox service providers, there is no way for mail
to get into the mailbox except through the domain in question, so the "my
configured envelope header fields don't exist in this random message" simply
cannot happen.

> I would have thought that it is very hard to guarantee that an incorrect
> e-mail will never, ever, fall in the catch-all mailbox.

Not true.  I can't speak to the specifics of other mail systems, but with
qmail, for example, it's trivially easy to accomplish this.

> Wouldn't it be better for getmail to consider a mail without the prescribed
> header defective, print an error to stderr, skip it and process the rest?

No.  That error message and abort are there to catch *configuration* errors.
If getmail ever encounters that situation - user has configured "domain
mailbox service, envelope recipient in <header>" and that header isn't 
present - something serious is wrong with the configuration, and getmail 
aborts to avoid causing major problems by delivering mail incorrectly.  It 
simply should not be happening; if it does, the user needs to fix their
configuration before retrying.

> That would be in order to increase robustness, so that one single broken
> mail does not stop the whole fetching altogether.

I have seen people make that argument before, but from my perspective the
change would significantly *decrease* getmail's robustness.  "I configured it
wrong but at least it still delivered my messages, but to the wrong user..."
is not a ringing endorsement in my book.

getmail goes very far in its efforts to never (a) lose mail, or (b) misdeliver
mail.  I'm not going to change that approach.

> > [...] but if anyone else ever sends mail to that address, it will fail
> > again.
> 
> I wonder if there is some way.

It basically sounds like your provider is just offering generic "catchall"
mail service, not a proper, domain mailbox service.  These sorts of problems
are inherent in simple/stupid catchall configs.

> > 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.
> 
> I wasn't aware that you could or should "expunge" your mailbox when you are
> a mail client user (Thunderbird). I'll have to investigate that too.

The IMAP EXPUNGE command is required for message deletion to take place; it's
defined in the spec.  DELETE just sets a flag, EXPUNGE removes those flagged
messages from the mailbox.

> I am wondering whether this should be a consideration for getmail. Roundcube
> knew that the e-mail was marked as "deleted". I am not sure whether it is a
> good idea for an e-mail that is somehow marked as "deleted" to be downloaded
> with getmail, be delivered to the internal Dovecot, and perhaps generate a
> bounce like "the mailbox is full". After all, maybe the admin has deleted
> the e-mail so that it is not downloaded after all.

Sorry, that's not how IMAP works.  If you want getmail to not see a message in
the mailbox, you will need to delete it and expunge it from the mailbox.

Charles

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