Date: 18 Dec 2002 13:24:24 -0800 From: Ken McGlothlen <mcglk@artlogix.com> To: "Mxsmanic" <mxsmanic@hotmail.com> Cc: "FreeBSD Questions" <freebsd-questions@freebsd.org> Subject: Re: Getting Perl scripts to work as mail filters Message-ID: <86fzsvrpfb.fsf@ralf.artlogix.com> In-Reply-To: <OE44LIqdqo0czTxscNK00003f79@hotmail.com> References: <OE44LIqdqo0czTxscNK00003f79@hotmail.com>
index | next in thread | previous in thread | raw e-mail
"Mxsmanic" <mxsmanic@hotmail.com> writes:
| What do I have to do to make a simple Perl script filter incoming mail for a
| mailbox? I wrote a script that just reads standard input and writes it to
| standard output, then put it in my home directory, then changes
| /etc/mail/aliases to point to it, like this:
|
| mymail: "|/usr/home/mymail/perlfilter"
I know that seems like the way it should work . . . but it's not. What that
does is just pipe the message to your script---and at that point, sendmail is
done. The output from your script went into the bit bucket.
What you're going to have to do is open up a sendmail process. You can do
something like this in your Perl script, though:
open( MAIL, "| /usr/sbin/sendmail" );
print MAIL $headers;
print MAIL $body;
close MAIL;
Your headers will have to have all the relevant information, and be separated
from the body with a blank line.
Good luck with that.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86fzsvrpfb.fsf>
