Mailing List Archive

presorting(filtering) email before using imap
I'm looking for some netwisdom....

I run Exim, delivery is maildir format. I then use Courier IMAP.
My preferred mail reader is evolution - from three or four different
devices.
This way, I can see the same e-mail on a static workstation (the main
mail server for me) or on any one of three laptops I run around with,
(then there is the occasional access via the i-Pad or smart-phone).

Evolution on my main mail server has gone mad, no longer starts up and
gives a "Timeout was reached, Trace/breakpoint trap"

All my 'filter' rules were in evolution (filter as in this mail should
go to that folder inside imap/evolution).

Is there a way to pre-filter emails according to subject/sender (etc) so
that imap serves pre-filtered e-mail to my mail reading devices?

What do people use - that actually works for themselves.
(Looking for working suggestions/examples!)

--
. . ___. .__ Posix Systems - (South) Africa
/| /| / /__ mje@posix.co.za - Mark J Elkins, Cisco CCIE
/ |/ |ARK \_/ /__ LKINS Tel: +27 12 807 0590 Cell: +27 82 601 0496
Re: presorting(filtering) email before using imap [ In reply to ]
On Wed, Apr 11, 2012 at 02:20:28PM +0200, Mark Elkins wrote:

>Is there a way to pre-filter emails according to subject/sender (etc) so
>that imap serves pre-filtered e-mail to my mail reading devices?

If your IMAP folders are normal mailboxes, then procmail or maildrop
should be fine - or exim filters for that matter.

R

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: presorting(filtering) email before using imap [ In reply to ]
On Wed, Apr 11, 2012 at 2:20 PM, Mark Elkins <mje@posix.co.za> wrote:
> Is there a way to pre-filter emails according to subject/sender (etc) so
> that imap serves pre-filtered e-mail to my mail reading devices?
>
> What do people use - that actually works for themselves.
> (Looking for working suggestions/examples!)


As Roger has already indicated Exim filters can do the job. These can
be text files or even queried from a database.

Otherwise an alternative IMAP server is Dovecot which has Sieve
support via a plugin (http://wiki2.dovecot.org/Pigeonhole/Sieve) which
can provide the filtering on messages as well.


thx

--
.warren

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: presorting(filtering) email before using imap [ In reply to ]
>
> As Roger has already indicated Exim filters can do the job. These can
> be text files or even queried from a database.
>
> Otherwise an alternative IMAP server is Dovecot which has Sieve
> support via a plugin (http://wiki2.dovecot.org/Pigeonhole/Sieve) which
> can provide the filtering on messages as well.
>
Actually, if you're happier using sieve, Exim has built in sieve functionality as well. Not full sieve functionality iirc, but enough for most requirements.

John
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: presorting(filtering) email before using imap [ In reply to ]
On 2012-04-11 13:20, Mark Elkins wrote:
> Is there a way to pre-filter emails according to subject/sender (etc) so
> that imap serves pre-filtered e-mail to my mail reading devices?

In addition to the other ideas, it's possible to do whatever
database lookups and processing you need in Exim's ACLs
and routers, finishing up with a directory/file name string
for the appendfile transport to use. External filters not
needed.

As always, there's more than one way.....

--
Jeremy

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: presorting(filtering) email before using imap [ In reply to ]
On 2012-04-11 at 14:20 +0200, Mark Elkins wrote:
> What do people use - that actually works for themselves.
> (Looking for working suggestions/examples!)

Sieve's the way to go. The up-side is it's a common language for mail
filtering; the down-side is, when I last looked at open web front-ends
for it, they all encoded their state and rules in magic comments, rather
than actually "understanding" Sieve, so you end up having to pick just
one front-end for management.

If you're happy working with text files, Sieve is easy anyway and you
can ignore that. Examples below.

Sieve is accompanied by ManageSieve, a protocol for uploading/activating
Sieve scripts; the server is required to syntax check at upload time.

With Exim, you can have Exim interpret the Sieve config; there's a
non-standard requirement for a header-line in the file, but if you use
pysieved as the server, it can take care of that for you.

There's also Sieve for dovecot, and Sieve for Cyrus IMAP which is what
I'm currently using. Dovecot's come a long way though and I'm seriously
considering switching. Here's where Sieve wins: I'll get to keep the
same filter rules for the new system.

There's one known ManageSieve command-line client which handles TLS
securely; er, I wrote it. It's since been adapted as the basis of a
Perl CPAN module. "sieve-connect".

Some snippets extracted from my sieve filter, which can redirect
messages to other addresses, which end up in other folders, handled
differently to "fileinto" because I have accumulated a crufty layout
over the years ... at least it lets me choose some okay samples. This
handles one of my old domains, "globnix.org", where I subscribed my own
email address directly to a number of mailing-lists. With spodhuis.org,
some Exim config means that if the IMAP folder exists, then the email
address exists, so I just subscribe with addresses such as
"exim-users@spodhuis.org" and avoid needing to write Sieve rules for
each list I subscribe to.

----------------------------8< cut here >8------------------------------
require ["fileinto", "envelope"];

if not header :matches "Envelope-to" "*@globnix.???" {
keep;
stop;
}

if exists "List-Id" {

if header :contains "List-Id" [
"<dhcp-announce.lists.isc.org>",
"<w3c-announce.w3.org>",
"<pgsql-announce.postgresql.org>",
"<conferences.yapceurope.org>"
] {
redirect "misc-announce@globnix.org"; stop;
}

if header :contains "List-Id" "<putty-announce.lists.tartarus.org>" {
redirect "sw-announce@spodhuis.org"; stop;
}

if header :contains "List-Id" "<risks.csl.sri.com>" {
fileinto "globnix/risks-digest"; stop;
}

}

if exists "Mailing-List" {

if header :matches :comparator "i;octet"
"Mailing-List" "contact zsh-users-help@zsh.org;*" {
fileinto "globnix/zsh-users"; stop;
}

}

if header :is "Content-Type" "text/html" {
fileinto "Spam/html-only"; stop;
}

# Default:
fileinto "globnix/rest";
stop;

# vim: set filetype=sieve sw=2 expandtab :
----------------------------8< cut here >8------------------------------

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/