Piero V.

IMAP downloader

Two weeks ago, I needed to mass-download a few IMAP mailboxes before migrating them to another provider.

Gist contains many scripts to do so, and I tried one of them, but it did not work as I wanted. I wanted to download all the IMAP folders, not only Inbox.

Therefore, I wrote my version of that script 😄️.

I used imapclient instead of the built-in imaplib because it is more Pythonic and handles all the tedious conversions between bytes, strings, and other types.

The center of the script is the process function. It connects to an IMAP server, queries the list of folders, and downloads all the messages from each one but trash and spam (but notice that the comparison is case-sensitive!).

client.fetch downloads all the messages you provide to it, which caused an OOM in my case. Therefore, I split the list with the message IDs into chunks. I had to write the batches function because I was running on Python 3.11. From Python 3.12, you can use itertools.batched instead. … [Leggi il resto]

Another rant on emails

A pair of weeks ago, some people asked me for help because their Outlook was not working anymore. It complained that its data file had reached the maximum size.

Being a Linux user, I have never had Outlook on my machines.

I used it only at my previous job, with an exchange server. I must admit it used to work fine. It even has some appreciable features, such as the company directory, shared calendars that work immediately, etc.

So, when people ask me if I can help them with their Outlook problems, I try to answer as a courtesy. Usually, they are easy problems, and I solve them by searching for their error messages in English and translating the solution into Italian.

One of the suggested solutions for the problem was to empty the bin. But it contained almost one million emails 😨️. So, I went to the webmail and found that the webmail also has the same amount of emails to delete.

The web client also says that emails are automatically deleted after 90 days, but it contained emails from more than two years ago.

It also has a button to empty the folder… but I think it communicates to the backend through IMAP itself, and of course, it went on timeout 😄️. … [Leggi il resto]

Parte VI muletto: i server Postfix e Dovecot

Introduzione

Ultima revisione: Settembre 2010

(Ovviamente) questa guida non è farina del mio sacco ma è l’insieme di più guide.

Una guida completa è Congiuriamo un server di posta completo se Debian etch (postfix) di Il portalinux.

Poi ho consultato anche questa guida su postfix su XS4ALL

Un’altra fonte sono i readme di Postfix Admin.

Per la configurazione di Dovecot ho consulato Johnny Chadda .se, anche se in realtà è solo da decommentare.

Attenzione:Per questo tutorial si userà la shell come root.

Alcune cose le darò per scontato, per esempio la modifica di un file di testo.

Questa, con l’editor nano si fa così: nano nomefile, per salvare un file si usa CTRL+O mentre per uscire dall’editor si fa CTRL+X. … [Leggi il resto]