The officially official Devuan Forum!

You are not logged in.

#1 2023-03-30 11:24:11

bai4Iej2need
Member
From: Ortenau
Registered: 2021-04-25
Posts: 102  

[SOLVED] mail filtering in console

I currently have a laptop powered up to sync and filter my emails with thunderbird, push them to different mail dirs and delete e.g. older messages to keep the volume down.
The laptop must have the user logged in Xorg to run thunderbird via crontab

No I want to shift this job to a server without xorg. and very low RAM (1GB)
application should load only the mail headers, because mail will never be read there.
application should sync with the imap server, so mail will be moved or purged there as well.
It would save the laptop to be powered up 24/7. The server runs anyhow.

I have seen that package alpine could do the job.

What is the experience with suitable Filter software ?


The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390

Offline

#2 2023-03-31 06:40:09

steve_v
Member
Registered: 2018-01-11
Posts: 361  

Re: [SOLVED] mail filtering in console

The traditional unixy solution (and likely the lightest on resources) is probably the old (fetchmail / getmail) -> procmail (+formail) -> (maildir / mda) construct. Assemble parts as needed smile

I was running fetchmail + procmail via cron as my mail filtering / delivery system for many years, though I have since moved to getmail for retrieval and  sieve within dovecot for filtering, as the box also acts as an IMAP server these days anyway.

The 'net at large should provide plenty of fetchmail/procmail/formail info, it's a system as old as the hills. Procmail filter syntax is a mite arcane, but it's very powerful once you get your head around it. Also here.

Alternatively (or if you're discouraged by the length of procmail's beard), you might just want to set up a real mailserver and use sieve scripts. As mentioned I use dovecot, but there are several other options.

As for alpine... I'm not sure why one would want to use a mail reader for automated retrieval and filtering, but if it can do it it can do it I guess. I'd consider fetchmail / getmail and a filter and/or mda of choice the more appropriate hammer though.

Any more detailed suggestions dependent on more detailed explanation of your setup (e.g. "mail dirs" meant in the traditional *nix maildir sense or folders within a maildir / mbox, where these boxes are and how your end-user readers access them, where your IMAP server is, etc.).

All the above assumes primarily syncing to and working with mail in local mailboxes or on your own mailserver (since that's how I do it), If you're more into manipulating a remote IMAP server you don't control I'll be of little use to you, and maybe something like alpine is the way to do it...
Or perhaps imapfilter. That one looks pretty promising for such a task, and could be combined with e.g. getmail or imapsync if you want a local backup as well.

Last edited by steve_v (2023-03-31 07:33:24)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#3 2023-05-14 12:55:02

bai4Iej2need
Member
From: Ortenau
Registered: 2021-04-25
Posts: 102  

Re: [SOLVED] mail filtering in console

I have now moved all the sorting into folders to my e-mail provider.

However they do not provide methods to delete older mails such as system mails or  forum threads.
This remains to be solved.

Last edited by bai4Iej2need (2023-05-14 12:56:30)


The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390

Offline

#4 2023-05-16 14:40:50

bai4Iej2need
Member
From: Ortenau
Registered: 2021-04-25
Posts: 102  

Re: [SOLVED] mail filtering in console

I have looked again and came to imapfilter, an existing package.
It does not download the Mails, it only scans the folders on the IMAP server.
The configuration is easy  and well explained.
2 to 3 lines per folder needed.

A test run has shown that the scan works, remains to do all the folders and their deletion rules.
almost solved

Last edited by bai4Iej2need (2023-05-22 07:56:12)


The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390

Offline

Board footer