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

Langenxx Feld <[email protected]> Thu, 5 Nov 2020 21:39:11 +0100
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
> [...]
> 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.

I understand. I am aware that it may not be possible to get a 100 % watertight solution.

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. I may even move a 
mail with the mouse in Roundcube, cough once, and drop a draft e-mail in the catch-all inbox by mistake. And the getmail with IDLE will immediately 
fetch it.

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? 
That would be in order to increase robustness, so that one single broken mail does not stop the whole fetching altogether.


> [...]
> but if anyone else ever sends mail to that
> address, it will fail again.

I wonder if there is some way. I will first write a list of checks that one should do when testing a new mail provider. Then identify if there are 
other ways in which such an invalid mail can get there. Then I could perhaps add some Sieve rule (or whathever) to filter out mails that don't have 
that header or have some other defect. This way, getmail will not see them.


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

That's easier said than done. I think a step-by-step list of checks can help, so that you can tell if a provider is a good one. If you are in a small 
business, a volunteer-driven organisation, or a charity, you do not have the resources or the negotiating position to ask such configuration details 
beforehand. Such technical details do not come up in the advertising. But many providers have a "30 day money back guarantee". Or do you know of a 
list on the Internet with "known good" mail providers?


> 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.

I am not sure whether that is a bug in the provider. I did a quick search and found many people mentioning similar phantom e-mails. But I put that 
task (investigating further) in my to-do list for later.

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.


> 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.

I had not explicitly expunged, because I don't know yet how to trigger that from Thunderbird. getmail was not connected, I am not using IDLE yet. I 
just launched it a few times afterwards and wondered why it was quitting early. I inspected stderr, and came to the conclusion that the deleted e-mail 
was somehow still there. I was lucky that the provider offers Roundcube, otherwise I could have dispaired. Perhaps that information is of no use to 
you, but I don't know enough yet.

Regards,
   rdiez