From owner-freebsd-questions Wed Dec 18 13:22:43 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D0FBA37B401 for ; Wed, 18 Dec 2002 13:22:41 -0800 (PST) Received: from c3po.artlogix.com (s01.artlogix.com [216.231.46.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6343A43EDC for ; Wed, 18 Dec 2002 13:22:41 -0800 (PST) (envelope-from mcglk@artlogix.com) Received: from ralf.artlogix.com.artlogix.com (unknown [192.168.0.3]) by c3po.artlogix.com (Postfix) with ESMTP id 2795C1A9BA; Wed, 18 Dec 2002 13:20:07 -0800 (PST) To: "Mxsmanic" Cc: "FreeBSD Questions" Subject: Re: Getting Perl scripts to work as mail filters References: From: Ken McGlothlen Date: 18 Dec 2002 13:24:24 -0800 In-Reply-To: Message-ID: <86fzsvrpfb.fsf@ralf.artlogix.com> Lines: 25 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "Mxsmanic" 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