Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2002 16:24:32 -0800 (PST)
From:      Jeff Jirsa <jeff@unixconsults.com>
To:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Getting Perl scripts to work as mail filters
Message-ID:  <20021218161618.T35315-100000@boris.st.hmc.edu>
In-Reply-To: <OE51Z9rWjAKYVpMmOlb00005e1f@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Dec 2002, Mxsmanic wrote:

> What about appending directly to the mailbox file under /var/mail/$USER with
> the script?  It looks like the format of the file is very simple.  Why
> wouldn't that work?  I've tried writing to it, but I can't, at least not
> when the script runs from the aliases file (works fine when I run it myself,
> though).
>
> Procmail is exactly the sort of bloated tool that I'm trying to avoid.
>
> I don't know that calling sendmail again would be _that_ hard.  After all,
> I'm mostly just copying the input to the output.  I guess all I'd have to do
> would be to change the recipient address to avoid a loop (?).  Right?  Can't
> I just leave all the headers intact otherwise?
>

Yes, using aliases would probably work to avoid a loop. You may even
want to clean out the Cc: and To: lines of anyone and everyone you didn't
want getting another copy (I'm not 100% sure this is the case, but it
seems to me that if there's a long list of people Cc:'d, calling sendmail
again without stripping them out will send them another email)..

Someone else mentioned it, I think it's worth mentioning again. I'm not
100% sure what you want to do, but I'm 99% sure you'd be better off using
Sendmail's Milter interface than trying to mess around with aliases and
.forward files.

Check out http://www.samag.com/documents/s=7178/sam0206l/. It's got an
example of a small perl script Milter, and the sendmail source has some
others (in C, last I checked).

- Jeff Jirsa



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021218161618.T35315-100000>