On Mon, Jul 25, 2005 at 07:15:37PM +0100, Hereward Cooper wrote:
> Hi,
> 
> I was wondering what the status of server side filtering is with DBMail?
> I see posts on the subject on various lists but nothing that practical.
> 
> Isn't it quite a commonly used feature in most systems?
> 
> If anyone has other ideas that I could use to filter incoming mail on
> the server I would love to hear them. [Setup currently is Exim4+SA
> passes the message straight onto dbmail-smtp, so I can't procmail].

You could use an Exim filter in combination with a transport that
delivers messages directly to a mailbox using dbmail-smtp.

Here's a router that uses a filter stored in the users table

dbmail_filter:
  driver = redirect
  domains = +dbmail_domains
  user = Debian-exim
  allow_filter
  allow_fail
  data = ${lookup mysql{                                       \
    SELECT                                                     \
      filter                                                   \
    FROM                                                       \
      users u,                                                 \
      aliases a                                                \
    WHERE                                                      \
      a.deliver_to = u.user_idnr AND                           \
      u.filter IS NOT NULL AND                                 \
      a.alias = '${quote_mysql:[EMAIL PROTECTED]'           \
  }                                                            \
  {$value}                                                     \
  fail}
  directory_transport = dbmail_mailbox

The filter returns an address of the form /user~mailbox/ which is then split up
by the transport.

dbmail_mailbox:
  debug_print = "T: dbmail_mailbox for $address_file"
  driver = pipe
  command = /usr/sbin/dbmail-smtp -m 
${substr_-1:${extract{2}{~}{$address_file}}} -u 
${substr_1:${extract{1}{~}{$address_file}}}
  delivery_date_add
  envelope_to_add
  return_path_add
  user = dbmail
  group = dbmail
  return_output

I'm not sure if this is working correctly in the latest versions of DBMail,
though.  See my recent message on the subject:
http://mailman.fastxs.net/pipermail/dbmail/2005-July/007045.html.

xn

Reply via email to