procmail
[Top] [All Lists]

Re: Please help -- couple of questions

1997-10-31 08:24:55
Ricardo Kleemann <ricardo(_at_)americasnet(_dot_)com> writes:
Let me expand on my questions... 

On Thu, 30 Oct 1997, Philip Guenther wrote:

1. does it at all support maildir format (in contrast to mailbox format)?

Someone has released a patch with add maildir support.  Check the qmail
site.
hmmm but then is this only for qmail or can this patch deliver maildir
support for sendmail?

It's a patch to _procmail_ so that procmail supports maildir format.
Since sendmail uses the local mailer (say, procmail) to deliver
messages, this allows you to move your system to maildir but still use
sendmail.


2. If it doesnt support maildir (which makes mailboxes over NFS very
feasible) is there a reliable NFS solution for delivering the mail? (I'm
using Linux 2.0.30)

Unless your NFS server is _totally_ broken, procmail reliably delivers
over NFS.
Ok, so let's say I setup procmail to deliver to $HOME/.mailbox (BTW how do
I do that with procmail?). Then all the home directories are mounted oer
NFS to multiple hosts. Some users will run pine, others will use POP3,
etc, etc... can I expect that there will be no problems with mail delivery
(and mail reading) due to NFS? I have yet to trust a mailbox over NFS
because of file locking difficulties over NFS...

Make sure all the mail readers and the POP server are compiled to use
dotlocking and things should be fine.  Since Linux 2.0.x doesn't
support kernel locking over NFS (they're working on it in the 2.1.x
branch) you _need_ dotlocking.


4. Can procmail be used to deliver a message BOTH to a local program and
at the same time redirect to a user? What I mean is, I have a makemap file
for sendmail which redirects email to some outside users... however I'd
like to also pipe the message (at least the "To:" header) into a program.
What's the best way to do that?

Yes.  If the values in your sendmail map are in "mailer:host" format
and it's checked from ruleset 0, then you should just be able to say

     whateveraddress         procmail:/etc/procmailrcs/whatever

ok, my makemap files are in the format:
someuser       otheruser(_at_)otherdomain(_dot_)com
and
someuser(_at_)somedomain(_dot_)com     otheruser(_at_)otherdomain(_dot_)com

and I have a couple thousand redirects like that in the makemap db...

by /etc/procmailrcs/whatever do you mean to say that each redirect would
have to have its own recipe entry? If so, that would be quite a pain to
have a couple thousand of those... :(

The following should work: have the table look like this:

        someuser                "|/usr/bin/procmail -m /etc/procmailrcs/redir 
otheruser(_at_)otherdomain(_dot_)com"
        someuser(_at_)somedomain(_dot_)com      "|/usr/bin/procmail -m 
/etc/procmailrcs/redir otheruser(_at_)otherdomain(_dot_)com"


You can then access the argument to procmail after the name of the procmailrc
("otheruser(_at_)otherdomain(_dot_)com" in both of the above cases) as follows:

        ARG = $1

        :0 c
        | some-program

        :0
        ! "$ARG"


That would be in the file /etc/procmailrcs/redir.

If mail for some addresses should be fed to one program, and mail for others
should be fed to another program, then you can do regexps matches on the
addresses passed in:

        ARG = $1

        # mail going to otherdomain.com should fed into program "foo"
        :0 c
        * ARG ?? @otherdomain.com^^
        | foo

        # mail going to elsewhere.com should be fed into program "bar"
        :0 c
        * ARG ?? @elsewhere.com^^
        | bar

        :0
        ! "$ARG"


Let's say that for the particular domain, I setup sendmail.cf such that it
will call procmail with a particular recipe. Can that recipe have what you
have above, but then instead of "! some(_at_)remote(_dot_)address" can I have a
makemap lookup, so it will send based on the incoming address an then
redirect it?

Procmail can't itself do database lookups, thus the trick of passing in
the needed info on the command line.  You can pass multiple arguments
and make decisions about what to do with the message on how many are
passed in and what they are.


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>