On 2024-06-05 13:50, Lucio Chiappetti via Alpine-info wrote:
On Tue, 4 Jun 2024, Chris M via Alpine-info wrote:

I am curious, does Alpine offer filtering rules?
Like if message TO is: Alpine List <alpine-info@u.washington.edu>

Are you the one which said to be new with alpine ?

Yes alpine offers filters, although I think the kind of filter you mean will be more efficiently implemented with procmail (whose syntax has however a steep learning curve). Also procmail works best as mail delivery agent, which implies you receive and store messages locally on your machine (which in turn might require fetchmail in conjunction with an IMAP server).

Problem is that filtering is made to local folders, not inside the imap server folders, so that other machines you may have or other mail clients will not see the filtered messages.

I found recently another curious solution, not trivial.

imapfilter

cer@Isengard:~> rpm  -qi imapfilter
...
URL         : https://github.com/lefcha/imapfilter
Summary     : A mail filtering utility
Description :
IMAPFilter is a mail filtering utility. It connects to remote mail
servers using the Internet Message Access Protocol (IMAP), sends
searching queries to the server and processes mailboxes based on the
results. It can be used to delete, copy, move, flag, etc. messages
residing in mailboxes at the same or different mail servers. The 4rev1
and 4 versions of the IMAP protocol are supported.

IMAPFilter uses the Lua programming language as a configuration and
extension language.
Distribution: SUSE Linux Enterprise 15 SP5




You need a ".imapfilter/config.lua" file defining what to do, and a cronjob to call it periodically.

Example.config.lua

gmail = IMAP {

server = 'imap.gmail.com',

username = 'usern...@gmail.com',

password = 'password',

ssl = 'tls1'

}


notspam_gl = gmail['[Gmail]/Spam']:contain_from('somename@somedomain') +

gmail['[Gmail]/Spam']:contain_from('name2@somedomain') +

gmail['[Gmail]/Spam']:contain_from('name@somedomain2')

notspam_gl:move_messages(gmail['Inbox'])


-- Comments. first I define the "gmail" account, then I do things on
-- that account, using name for the actions "notspam_gl". First find
-- the messages, then move them.

The call:

~> imapfilter -l /path/logfile -d /path/debugfile 2>&1 >> /path/logfile



What the example does: moves some mail that gmail thinks is spam back to the inbox folder (inside gmail server).

Documentation:

-- https://github.com/lefcha/imapfilter

-- https://github.com/lefcha/imapfilter/blob/master/samples/config.lua


--
Cheers / Saludos,

                Carlos E. R.
                (from 15.5 x86_64 at Telcontar)

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Alpine-info mailing list
Alpine-info@u.washington.edu
http://mailman12.u.washington.edu/mailman/listinfo/alpine-info

Reply via email to