Perl filtering before final delivery

Mike Brodbelt m.brodbelt at acu.ac.uk
Fri Oct 25 09:31:24 EDT 2002


Ian McDonald wrote:
> 
> The IMAP users won't have Unix logins on the server. This FAQ answer
> suggests that putting the IMAP users in /etc/passwd is a prerequesite for
> using .forward. Is it?

Yes. The FAQ addresses sendmail, and you don't actually say which MTA
you're using, but it is the MTA which honours .forward files, and not
Cyrus. Sendmail, upon seeing a message destined for the local delivery
agent, looks in the approriate user's home directory for a .forward
file, assuming the local mailer definition contains the w flag.

> Sieve isn't adequate for my mail filtering purposes. I want to (for example)
> do database access, fiddle with the headers, *and* send it to the right
> folder.

If you are using sendmail, the cleanest way of doing what you want would
be to make use of the milter interface, which allows you to pass
messages through an external program that can change them as you wish.
This would not require users to have accounts on the server, and would
not interfere with the normal cyrus delivery mechanisms. For examples of
something similar, look at the sendmail milters available for hooking in
Spam Assassin.

> The Perl modules Mail::Audit and Mail::Procmail only deliver to mbox and
> Maildir formats, so I can't use them.

You shouldn't be trying to mess with the mail store. Leave that to
cyrus. If you want to deliver to cyrus, use LMTP.

> So, when I have an amended mail message and a destination folder, what do I
> do? Call /usr/cyrus/bin/deliver with my settings?

Yes, you could do that. Deliver is just a wrapper that sends a message
submitted to it to Cyrus via LMTP. If you can do your processing in the
MTA pipeline, before it reaches Cyrus however, I think you'll have a
better solution. The Milter interface for sendmail allows you additional
latitude, such as specifying what should happen if the filter is not
available, and multiple filters can also be chained together. Other
MTA's may have other means of achieving this.

Mike.





More information about the Info-cyrus mailing list