Procmail|Maildrop workflow

286 views
Skip to first unread message

Eduardo Mercovich

unread,
Aug 8, 2016, 9:15:19 AM8/8/16
to mu-di...@googlegroups.com
Hi everyone, hi Dirk.

I've been seeing mentions of this, and I'm curious becase mail filtering
is something I'd like to add here too.

Reading a bit about procmail/maildrop seems -to the uninitiated to the
mail infrastructure- integrated with mail servers. While specific info
about configuration for mail filtering is easy to find, I'm failing to
find the relevant workflow documentation, most surely because I don't
know what are the relevant keywords and a lot of the relevant knowledge
seems assumed.

So the question is: how do you integrate mbsync/offlineimap with
procmail/maildrop? Where does they kick in to filter emails?

A general idea and some references to start would be more than enough.
As always, thanks a lot for sharing that hard earned knowledge. :)

Best...


--
eduardo mercovich

Donde se cruzan tus talentos
con las necesidades del mundo,
ahí está tu vocación.

Dirk-Jan C. Binnema

unread,
Aug 8, 2016, 5:03:50 PM8/8/16
to mu-di...@googlegroups.com

On Monday Aug 08 2016, Eduardo Mercovich wrote:

> Hi everyone, hi Dirk.
>
> I've been seeing mentions of this, and I'm curious becase mail filtering
> is something I'd like to add here too.
>
> Reading a bit about procmail/maildrop seems -to the uninitiated to the
> mail infrastructure- integrated with mail servers. While specific info
> about configuration for mail filtering is easy to find, I'm failing to
> find the relevant workflow documentation, most surely because I don't
> know what are the relevant keywords and a lot of the relevant knowledge
> seems assumed.
>
> So the question is: how do you integrate mbsync/offlineimap with
> procmail/maildrop? Where does they kick in to filter emails?
>
> A general idea and some references to start would be more than enough.
> As always, thanks a lot for sharing that hard earned knowledge. :)

For some accounts, I'm using procmail with with Gmail/POP, and use
fetchmail to get my mail:

--8<---------------cut here---------------start------------->8---
poll pop.gmail.com with proto POP3
user 'us...@gmail.com' there with password 'topsecret' is 'user' here
options fetchall keep ssl mda "/usr/bin/procmail -m /home/user/.procmailrc"
--8<---------------cut here---------------end--------------->8---

You should be able to find some procmailrc recipes online.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Eduardo Mercovich

unread,
Aug 9, 2016, 4:55:56 PM8/9/16
to mu-di...@googlegroups.com
Hi Dirk-Jan.

>> I've been seeing mentions of this, and I'm curious becase mail
>> filtering is something I'd like to add here too. [...] I'm failing to
>> find the relevant workflow documentation, [...] So the question is:
>> how do you integrate mbsync/offlineimap with procmail/maildrop? Where
>> does they kick in to filter emails?

> For some accounts, I'm using procmail with with Gmail/POP, and use
> fetchmail to get my mail:
> --8<---------------cut here---------------start------------->8---
> poll pop.gmail.com with proto POP3
> user 'us...@gmail.com' there with password 'topsecret' is 'user' here
> options fetchall keep ssl mda "/usr/bin/procmail -m /home/user/.procmailrc"
> --8<---------------cut here---------------end--------------->8---

Sorry that I don't get it, I lack some basic understanding about how
email infrastructure works. I'll ask simpler: is it possible to use
procmail (or maildrop) with mbsync/offlineimap or it is only for use
with fetchmail?

Thanks a lot... :)

Dirk-Jan C. Binnema

unread,
Aug 9, 2016, 5:45:46 PM8/9/16
to mu-di...@googlegroups.com

On Tuesday Aug 09 2016, Eduardo Mercovich wrote:

>>> I've been seeing mentions of this, and I'm curious becase mail
>>> filtering is something I'd like to add here too. [...] I'm failing to
>>> find the relevant workflow documentation, [...] So the question is:
>>> how do you integrate mbsync/offlineimap with procmail/maildrop? Where
>>> does they kick in to filter emails?
>
>> For some accounts, I'm using procmail with with Gmail/POP, and use
>> fetchmail to get my mail:
>> --8<---------------cut here---------------start------------->8---
>> poll pop.gmail.com with proto POP3
>> user 'us...@gmail.com' there with password 'topsecret' is 'user' here
>> options fetchall keep ssl mda "/usr/bin/procmail -m /home/user/.procmailrc"
>> --8<---------------cut here---------------end--------------->8---
>
> Sorry that I don't get it, I lack some basic understanding about how
> email infrastructure works. I'll ask simpler: is it possible to use
> procmail (or maildrop) with mbsync/offlineimap or it is only for use
> with fetchmail?

Yes, it's possible to use offlineimap with procmail; first google hit:
http://hoardedhomelyhints.dietbuddha.com/2014/04/email-offlineimap-and-procmail.html
though the combination with fetchmail is a bit more natural I'd say.

Basically, what you want is some program that gets mail (such as
fetchmail) or even postfix/qmail etc. to not simply write the mail to
local files, but instead pass them through a (procmail) scripts, which
decides where to put the message file, or perhaps delete or transform
it.

Eduardo Mercovich

unread,
Aug 9, 2016, 10:02:10 PM8/9/16
to mu-di...@googlegroups.com
Hi Dirk-Jan.

>>>> I've been seeing mentions of this, and I'm curious becase mail
>>>> filtering is something I'd like to add here too. [...] I'm failing to
>>>> find the relevant workflow documentation, [...] So the question is:
>>>> how do you integrate mbsync/offlineimap with procmail/maildrop? Where
>>>> does they kick in to filter emails?

> Yes, it's possible to use offlineimap with procmail; first google hit:
> http://hoardedhomelyhints.dietbuddha.com/2014/04/email-offlineimap-and-procmail.html
> though the combination with fetchmail is a bit more natural I'd say.

I searched "(procmail OR maildrop) (offlineimap OR mbsync)" and have all
the following 6 hits visited. No idea why I didn't visited that 1st
one... (maybe I shouldn't leave those things for the time when the rest
of the family is already asleep). ;)

> Basically, what you want is some program that gets mail (such as
> fetchmail) or even postfix/qmail etc. to not simply write the mail to
> local files, but instead pass them through a (procmail) scripts, which
> decides where to put the message file, or perhaps delete or transform
> it.

I'm learning as I go, so for the benefit of future newbies and system
ignorants as me, reading what seems at fist some slightly cryptic lines in
that article:
+ crontab is to execute syncemail repeatedly so that's not it.
+ .procmailrc are the processing rules, so that leaves...
+ ... syncemail as the relevant portion.

So syncemail gets the mail (offlineimap) and then each regular file in
the maildir newer than some timestamp (the one from $PROCMAILD/log?) is
passed through procmail (cat "$i" | procmail).

I assume that procmail then writes it again (or moves or modifies it)
depending on the defined rules.

I read about procmail and it seems that maildrop is newer and the rules
language is easier than procmail, but I assume it depends on how much
each person knows each tool. :)

Other related tools (probably not worth to try if maildrop works) are
afew (https://github.com/teythoon/afew) that is done for notmuch but
seems independent from it, and procmail-py. Anyway, I'll start with
maildrop and continue from there as things develop.

Thank you very much.

Best...
Reply all
Reply to author
Forward
0 new messages