Score:2

Storing complete emails including linked images

sy flag

In short, I need to store emails in their entirety; not just the headers, text, and HTML, but also any images linked to in the content.

I currently have a mail server set up with Postfix and Dovecot. I use it to receive newsletter emails which are often image rich. I've found an issue whereby after a while, many of the links to the images become invalid, rendering the content useless. I'd like to find a way to capture this content. Ideally I'd like a server-side solution, and I'd like to be able to browse the newsletter content from a mail client. Perhaps if the server were to download the images in emails as they're received and update the URLs in the emails to point to the downloaded image? Or perhaps base64 encode the images and have them inline?

Failing this, I could look for a client side solution; perhaps a Thunderbird plugin that downloads and caches the images, but then I can't share the newsletter library with others by simply giving them access to the email account. For this reason, and local storage requirements, client-side is not the preferred solution.

Potentially I could write something that would download and encapsulate each email as a PDF, but I do like the idea of being able to use an email client to browse the content.

Has anyone faced a similar challenge? Is anyone aware of any tools that might help support this, or am I in uncharted territory? Any thoughts or ideas most welcome.

anx avatar
fr flag
anx
A bash "one"-liner looping over all mails in relevant IMAP folders, skipping already processed mail, piping it to a MIME extractor and calling `chromium --headless --print-to-pdf` on each html part worked okay for me. Configuring my spam filter to just reject mail where the content is not properly sent along worked better ;)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.