Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

exim and sieve filters

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


rschroev_nospam_ml at fastmail

Sep 24, 2009, 12:27 AM

Post #1 of 9 (1785 views)
Permalink
exim and sieve filters

Hi,

We currently have a setup where exim delivers to Maildir, and each user
has a .forward with an exim filter. Users access their mail using
Thunderbird via IMAP (using dovecot). So far, everything is working fine.

Now I'm looking for a way to automatically label all new mails in one
specific account so they appear as 'to do' in Thunderbird (I can't do
that in Thunderbird itself since it's a shared account that's used from
different client machines). As far as I can see, that cannot be done in
an exim filter, but it can be done in a sieve filter using addflag
"$label4".

I tried that, but that doesn't work in the current setup; the log says

appendfile: file or directory name "inbox" is not absolute

The docs say that the name inbox must be handled for Sieve filters, and
show a way to set the file setting in the appendfile transport.

So I think I need to set the directory setting (not file, since we're
using Maildir) in the appendfile transport in a way that handles the
Sieve name 'inbox' in a way suitable for Maildir, and also still
supports the exim filters of all the other accounts (though I could
convert all those to Sieve filters if there's no other way).

I thought that should be a relatively common setup, but I can't find any
information on it. Can someone give me some pointers on how to do this?

(we're using exim 4.63-17 on Debian etch)

Best regards,
Roel

--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven


--
## List details at http://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/


michael.haardt at freenet

Sep 24, 2009, 3:30 AM

Post #2 of 9 (1705 views)
Permalink
Re: exim and sieve filters [In reply to]

On Thu, Sep 24, 2009 at 09:27:35AM +0200, Roel Schroeven wrote:
> As far as I can see, that cannot be done in
> an exim filter, but it can be done in a sieve filter using addflag
> "$label4".

I don't know what addflag is supposed to be, but:

> I tried that, but that doesn't work in the current setup; the log says
>
> appendfile: file or directory name "inbox" is not absolute
>
> The docs say that the name inbox must be handled for Sieve filters, and
> show a way to set the file setting in the appendfile transport.

Right, you need to convert the folder name in $address_file to an
absolute name. For mailbox, use "file", for maildir use "directory".

> So I think I need to set the directory setting (not file, since we're
> using Maildir) in the appendfile transport in a way that handles the
> Sieve name 'inbox' in a way suitable for Maildir, and also still
> supports the exim filters of all the other accounts (though I could
> convert all those to Sieve filters if there's no other way).

It all depends on how users save their mails. If you handle relative
paths right, you can run Exim and Sieve filters mixed:

file = ${if eq{$address_file}{inbox} \
{/var/mail/$local_part} \
{${if eq{${substr_0_1:$address_file}}{/} \
{$address_file} \
{$home/mail/$address_file} \
}} \
}

This converts "inbox" to /var/mail/$local_part and anything else is
taken as absolute path, if it begins with "/", and used relative
to $home/mail otherwise. For maildir, use directory, but other than
that, it's the same.

Michael

--
## List details at http://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/


rschroev_nospam_ml at fastmail

Sep 25, 2009, 6:56 AM

Post #3 of 9 (1695 views)
Permalink
Re: exim and sieve filters [In reply to]

Michael Haardt schreef:

> It all depends on how users save their mails. If you handle relative
> paths right, you can run Exim and Sieve filters mixed:
>
> file = ${if eq{$address_file}{inbox} \
> {/var/mail/$local_part} \
> {${if eq{${substr_0_1:$address_file}}{/} \
> {$address_file} \
> {$home/mail/$address_file} \
> }} \
> }
>
> This converts "inbox" to /var/mail/$local_part and anything else is
> taken as absolute path, if it begins with "/", and used relative
> to $home/mail otherwise. For maildir, use directory, but other than
> that, it's the same.

Thanks for your answer. I've been experimenting a bit, and it turns out
that my problem is of a different nature than I first thought, therefore
I'm going to start a new thread for it.


--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven


--
## List details at http://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/


markdv.exim at asphyx

Sep 26, 2009, 1:35 AM

Post #4 of 9 (1698 views)
Permalink
Re: exim and sieve filters [In reply to]

Roel Schroeven wrote:
> Hi,
>
> We currently have a setup where exim delivers to Maildir, and each user
> has a .forward with an exim filter. Users access their mail using
> Thunderbird via IMAP (using dovecot). So far, everything is working fine.
>
> Now I'm looking for a way to automatically label all new mails in one
> specific account so they appear as 'to do' in Thunderbird (I can't do
> that in Thunderbird itself since it's a shared account that's used from
> different client machines). As far as I can see, that cannot be done in
> an exim filter, but it can be done in a sieve filter using addflag
> "$label4".

So, to avoid confusion, you are using a sieve filter in dovecot, and not
the exim sieve filter capabilities, right? If so...

> I tried that, but that doesn't work in the current setup; the log says
>
> appendfile: file or directory name "inbox" is not absolute

then would this - writing messages directly to the maildir - even work?

Could be that you need to have dovecot deliver the message in order for
it to apply its sieve filter. Probably meaning you have to use a pipe
transport in exim in combination with a local delivery agent from
dovecot to deliver the messages.

You could probably set up your routers in such a way that messages for
which the exim filter set up delivery are passed to your appendfile
transport and the rest is routed to a transport that uses the LDA from
dovecot... (Assuming dovecot will play nice when using different
delivery methods simultaneously. Don't know dovecot, so I can't say.)

Cheers,
Mark.

P.S.

> (we're using exim 4.63-17 on Debian etch)

If you want something newer, there's 4.69 in backports.


--
## List details at http://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/


rschroev_nospam_ml at fastmail

Sep 27, 2009, 3:18 AM

Post #5 of 9 (1683 views)
Permalink
Re: exim and sieve filters [In reply to]

Mark de Vries schreef:
> Roel Schroeven wrote:
>> Hi,
>>
>> We currently have a setup where exim delivers to Maildir, and each user
>> has a .forward with an exim filter. Users access their mail using
>> Thunderbird via IMAP (using dovecot). So far, everything is working fine.
>>
>> Now I'm looking for a way to automatically label all new mails in one
>> specific account so they appear as 'to do' in Thunderbird (I can't do
>> that in Thunderbird itself since it's a shared account that's used from
>> different client machines). As far as I can see, that cannot be done in
>> an exim filter, but it can be done in a sieve filter using addflag
>> "$label4".
>
> So, to avoid confusion, you are using a sieve filter in dovecot, and not
> the exim sieve filter capabilities, right? If so...

No, I'm trying to use a the sieve filter from exim, not from dovecot.
Though I'm starting to think that it might be best to switch to dovecot
for delivering and filtering mail.

> You could probably set up your routers in such a way that messages for
> which the exim filter set up delivery are passed to your appendfile
> transport and the rest is routed to a transport that uses the LDA from
> dovecot... (Assuming dovecot will play nice when using different
> delivery methods simultaneously. Don't know dovecot, so I can't say.)

We have less than a dozen accounts, so in the end it's not that
difficult to convert all filters to sieve if needed, and do everything
via the dovecot delivery agent. I'm going to have to look into that, or
perhaps other alternatives.

> P.S.
>
>> (we're using exim 4.63-17 on Debian etch)
>
> If you want something newer, there's 4.69 in backports.

Good to know, thanks for that.

--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven


--
## List details at http://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/


markdv at asphyx

Sep 28, 2009, 3:26 AM

Post #6 of 9 (1660 views)
Permalink
Re: exim and sieve filters [In reply to]

Roel Schroeven wrote:
> Mark de Vries schreef:
>> Roel Schroeven wrote:
>>> Hi,
>>>
>>> We currently have a setup where exim delivers to Maildir, and each user
>>> has a .forward with an exim filter. Users access their mail using
>>> Thunderbird via IMAP (using dovecot). So far, everything is working fine.
>>>
>>> Now I'm looking for a way to automatically label all new mails in one
>>> specific account so they appear as 'to do' in Thunderbird (I can't do
>>> that in Thunderbird itself since it's a shared account that's used from
>>> different client machines). As far as I can see, that cannot be done in
>>> an exim filter, but it can be done in a sieve filter using addflag
>>> "$label4".
>> So, to avoid confusion, you are using a sieve filter in dovecot, and not
>> the exim sieve filter capabilities, right? If so...
>
> No, I'm trying to use a the sieve filter from exim, not from dovecot.
> Though I'm starting to think that it might be best to switch to dovecot
> for delivering and filtering mail.

Hmm, the reason I assumed dovecot is because the sieve filter in exim
can't addflag's to messages... So if that's what you want to do then I
think you don't have much choice but to do the sieve filterin in dovecot.

Cheers,
Mark.


--
## List details at http://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/


rschroev_nospam_ml at fastmail

Sep 28, 2009, 10:04 AM

Post #7 of 9 (1671 views)
Permalink
Re: exim and sieve filters [In reply to]

Mark de Vries schreef:
> Could be that you need to have dovecot deliver the message in order for
> it to apply its sieve filter. Probably meaning you have to use a pipe
> transport in exim in combination with a local delivery agent from
> dovecot to deliver the messages.
>

I solved my problem the easy/lazy way: I use the LDA from dovecot via a
pipe command in .forward: I put

| "/usr/lib/dovecot/deliver"

in .forward of the account I need it for (that's the location of deliver
on Debian; it's different on other systems).
I also created .dovecot.sieve containing

# CMUsieve (dovecot LDA)

require ["imapflags", "fileinto" ];

# Dump messages that SpamAssassin considers spam to Junk folder
if header :contains "x-spam-score" "++++" {
fileinto "Junk";
}

else {
# Add label "to do"
addflag "$Label4";
keep;
}

in the home dir of that account. Works like a charm. I like it that
dovecot lets me use mail folder names as IMAP-clients see them, as
opposed to the real names in the filesystem as exim requires me to do
(AFAIK).



--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven


--
## List details at http://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/


markdv.exim at asphyx

Sep 28, 2009, 11:06 AM

Post #8 of 9 (1681 views)
Permalink
Re: exim and sieve filters [In reply to]

Roel Schroeven wrote:
> Mark de Vries schreef:
>> Roel Schroeven wrote:
>>> Hi,
>>>
>>> We currently have a setup where exim delivers to Maildir, and each user
>>> has a .forward with an exim filter. Users access their mail using
>>> Thunderbird via IMAP (using dovecot). So far, everything is working fine.
>>>
>>> Now I'm looking for a way to automatically label all new mails in one
>>> specific account so they appear as 'to do' in Thunderbird (I can't do
>>> that in Thunderbird itself since it's a shared account that's used from
>>> different client machines). As far as I can see, that cannot be done in
>>> an exim filter, but it can be done in a sieve filter using addflag
>>> "$label4".
>> So, to avoid confusion, you are using a sieve filter in dovecot, and not
>> the exim sieve filter capabilities, right? If so...
>
> No, I'm trying to use a the sieve filter from exim, not from dovecot.
> Though I'm starting to think that it might be best to switch to dovecot
> for delivering and filtering mail.

Hmm, the reason I assumed dovecot is because the sieve filter in exim
can't "addflag"... So if that's what you want to do then I think you
don't have much choice but to do the sieve filtering in dovecot.

Cheers,
Mark.

--
## List details at http://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/


rschroev_nospam_ml at fastmail

Sep 29, 2009, 9:42 AM

Post #9 of 9 (1661 views)
Permalink
Re: exim and sieve filters [In reply to]

Mark de Vries schreef:
> Roel Schroeven wrote:
>> Mark de Vries schreef:
>>> Roel Schroeven wrote:
>>>> Hi,
>>>>
>>>> We currently have a setup where exim delivers to Maildir, and each user
>>>> has a .forward with an exim filter. Users access their mail using
>>>> Thunderbird via IMAP (using dovecot). So far, everything is working fine.
>>>>
>>>> Now I'm looking for a way to automatically label all new mails in one
>>>> specific account so they appear as 'to do' in Thunderbird (I can't do
>>>> that in Thunderbird itself since it's a shared account that's used from
>>>> different client machines). As far as I can see, that cannot be done in
>>>> an exim filter, but it can be done in a sieve filter using addflag
>>>> "$label4".
>>> So, to avoid confusion, you are using a sieve filter in dovecot, and not
>>> the exim sieve filter capabilities, right? If so...
>> No, I'm trying to use a the sieve filter from exim, not from dovecot.
>> Though I'm starting to think that it might be best to switch to dovecot
>> for delivering and filtering mail.
>
> Hmm, the reason I assumed dovecot is because the sieve filter in exim
> can't "addflag"... So if that's what you want to do then I think you
> don't have much choice but to do the sieve filtering in dovecot.

Ah, I didn't know that. The docs state

"A Sieve filter contains instructions in the Sieve format that is
defined by RFC 3028. As this is a standard format, Sieve filter files
may already be familiar to some users. Sieve files should also be
portable between different environments. However, the Exim filtering
facility contains more features [...]"

and

"However, for Sieve filters, only issues that relate to the Exim
implementation are discussed, since Sieve itself is described elsewhere."

which made me think that Exim would support addflag; Now that I look
better I see that RFC 3028 doesn't mention addflag.

One more reason to use dovecot deliver for Sieve filtering :)

--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven


--
## List details at http://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/

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.