[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Postfix-mysql-procmail

Fraser Campbell wrote:

On January 10, 2004 09:17 am, Robert Hensel wrote:

I currently have a properly working postfix-mysql setup. This all works
fine, but I would like to implement an autoresponder/other stuff. The
problem is, that for example procmail doesn't seem to work with virtual
users. I have added "mailbox_command = /usr/bin/procmail ". But this
line is completely ignored :(

Maybe someone here can help me avoid writing ugly bash scripts to do the
job ;)

The virtual delivery agent doesn't support procmail, .forward files, etc. I believe you have no choice but to do some scripting (it can be ugly if you insist ;-)

I'll assume that your talking about an email setup similar to the one described at http://kirb.insanegenius.net/postfix.html ?

The only way that I can think of to do things like mail filtering, out of office, etc. is by having a virtual map entry that forwards the email to an alias as well as to the original user:

    fraser@wehave.net		fraser@wehave.net,fraser-filters

In the aliases file (which could be managed in mysql still) you would have the alias fraser-filters pipe to a command that does whatever magic you need. This might already be what you were thinking of?

I haven't tried this but it's the easiest way that I can think of supporting mail filtering, out of office and such. You can also write postfix filters which might have advantages.

If you find anything please followup here as it's something I think a lot of people might be interested in.

Being through this, I'd like to add my 0.02 EUR.

I have a handful of servers set up with postfix, mysql, amavisd-new, spamassassin, and a home-brew administration interface in PHP.
I'm in the process of adding per-user support for:
- auto-replies (out of office, "your mail has been received" etc)
- auto-copy to antoher user
- auto-forward to another user (both for users on vacation)

I did the first version in PHP (as I already had a function that got me the final recipient mailbox), triggered by postfix's always_bcc parameter. This basically does the job, but at the cost of loosing the "for: xxx" component in the Received: header, which I also need for antoher component (the maillog scanner).

To make a long story short, the technically correct way is to do this via content-filtering. I'm not through with this, so this is the untested picture I have in my head for this issue. I'll post an announcement here when I'm through this.

A configuration example (not tested; and note I also use amavisd-new):

# Filter mail through amavisd-new first
content_filter = smtp:[localhost]:10024

localhost:10025 \
  inet  n       -       -       -       -       \
  smtpd -o content_filter=vacation
localhost:10026 \
  inet  n       -       -       -       -       \
  smtpd -o content_filter=
vacation unix n - - - - pipe user=nobody \
  argv=/usr/local/bin/my-vacation ${sender} ${recipient}

/usr/local/bin/my-vacation should handle all that vacation/forwarding stuff (_and_ should honor "Precedence: bulk" and "Precedence: list" headers properly!!!). If the mail should get to the original receiver, it is handed over to postfix via SMTP on port 10026. For best throughput, my-vacation should be a smtp-based client/server (like amavisd-new is).

So the mail flow will be:

Postfix (smtp on port 25)
amavisd-new (smtp port 10024)
Postfix (smtp port 10025)
my-vacation (pipe) -----------+------------------------
   |                          |                       |
Postfix (smtp port 10026)    Postfix (smtp port 25)  Postfix (smtp 25)
(to original receiver)       (cc or forward)         (response)


Reply to: