First, I'll explain my email system. It's complicated.
To tell other computers where to send email for me, we use the DNS (Domain Name Service) system. In that, an MX (Mail eXchange) record tells other computers where to send my email. There are two main servers, mail2 and mail1. The MX record tell the priority. So, mail is sent to mail2, unless mail2 isn't working, in which case it goes to mail1. Both are Raspberry Pis, version 1, vintage 2012. I also retreive email from several AOL and Gmail accounts.
Mail1 gets spam, nearly everything. Because it shouldn't be used unless mail2 isn't working. I take advantage of this by setting up a bunch of MX records with even lower priority as spam traps.
But I don't want to visit both computers, so I set up fetchmail, to visit each in turn and use the IMAP protocol to collect unread mail and put it on my email reading computer., xantl. To read mail I use pine or alpine, a text-only reader. That means that I don't have to worry about unpleasant surprises that you can get in web-based readers.
When it gets to xantl, it passes through my mail spam filter,sorting the mail.
So what went wrong? Suddenly, fetchmail stopped fetching mail from mail2 and mail1. I hadn't made any recent changes. This happened a few weeks ago.
So I tried fetchmail -vvv (verbose) but that told me nothing useful.
I tried reinstalling fetchmail. i tried installing fetchmail on another computer. I tried reinstalling dovecot (the IMAP server) on the pis. nothing worked. I tried updating OpenSSL - no joy.
I tried using .forward on mail1, but that didn't help. and all this while, I was reading an dealing with emal on mail2 and mail1.
I tried changing the MX records to a different computer. No use.
Then I did what I should have done in the first place. Google is a great resource, but I also have a file where I keep a record of past problems and thier solitions, and I found this gem.
To see what fetchmail is doing:
fetchmail -Nvvvd0 --nosyslog
So I did that, and it told that the problem was that fetchmail couldn't negotiate a secure channel with mail1. But I don't need a secure channel because the whole network is secured.
So I added
to the .fetchmailrc, telling fetchmail not to use secure sockets.
And everything worked!
I think this happened because fetchmail updated itself without telling me. The fact that a couple of weeks of Googling turned up nothing, makes me think that I'm the only person who has ever had this problem. There can't be many people using fetchmail release 6.4.23 to retreive mail from 10 year old Raspberry Pis.