[exim] Exim and Sieve filters

トップ ページ
このメッセージを削除
このメッセージに返信
著者: exim.calvin
日付:  
To: exim-users
題目: [exim] Exim and Sieve filters
Hi all,

I'm trying to setup exim to work with sieve filters. I'm using exim
4.34, courier-IMAP, maildir format, and have virtual user account for
multiple domains in a mysql database. All that works well.

Now I'm trying to enable sieve filters. I have added a new router and
transport for those (config is attached below), and I can get this
working. However, I have a problem mapping the "INBOX" /
"INBOX.subfolder" names from the sieve script to the directory I want
the mail delivered to.

If the sieve filter would do a

fileinto "subfolder2";

then I can put it into the right folder by doing

directory = ${lookup mysql{SELECT maildir FROM mailaccount WHERE
username = '${local_part}' AND domain = '${domain}' AND deliver =
'yes'}}.$address_file

in the transport. However, the sieve script will likely say

fileinto "INBOX.subfolder2";

so I would need to change "INBOX" into my maildir lookup form the
database. Section 26.1 of the exim doc shows how to do an if statement
to check for inbox, but that would only cover "INBOX", not
"INBOX.subfolder2".

Any ideas how to get that config right? Thanks in advance,

Christian


My router (the lookup will return something like
"/opt/testdomain.com/mail/username/", which is basically the INBOX
directory for the user)

virtual_filter:
driver = redirect
condition = ${lookup mysql{SELECT maildir FROM mailaccount WHERE username = '${local_part}' AND domain = '${domain}' AND active = 'yes'}}
require_files = /opt/${domain}/mail/${local_part}/.forward
file = /opt/${domain}/mail/${local_part}/.forward
allow_filter = yes
user = mail
directory_transport = virtual_filter_delivery
file_transport = virtual_filter_delivery


My transport

virtual_filter_delivery:
driver = appendfile
directory = ${lookup mysql{SELECT maildir FROM mailaccount WHERE username = '${local_part}' AND domain = '${domain}' AND deliver = 'yes'}}.$address_file
maildir_format = true
delivery_date_add
envelope_to_add
return_path_add
group = ${lookup mysql{SELECT gid FROM domain WHERE domain = '${domain}'}}
mode = 0660
directory_mode = 770