From owner-freebsd-questions Wed Dec 18 16:40:37 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 84ABE37B401 for ; Wed, 18 Dec 2002 16:40:35 -0800 (PST) Received: from mail5.sea.registeredsite.com (mail5.sea.registeredsite.com [66.111.73.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF9AB43EB2 for ; Wed, 18 Dec 2002 16:40:33 -0800 (PST) (envelope-from admin@asarian-host.net) Received: from asarian-host.net (asarian-host.net [216.122.74.112]) by mail5.sea.registeredsite.com (8.12.6/8.12.6) with ESMTP id gBJ0eMZ3025226 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 18 Dec 2002 19:40:23 -0500 Comments: To protect the identity of the sender, certain header fields are either not shown, or masked. Anonymous email addresses for asarians can be requested by filling in the appropriate form at: https://asarian-host.net/cgi-bin/signup.cgi Received: (from root@localhost) by asarian-host.net (8.11.6/8.11.0) id gBJ0eLa60363 for freebsd-questions@freebsd.org; Thu, 19 Dec 2002 01:40:21 +0100 (CET) (envelope-from admin@asarian-host.net) Posted-Date: Thu, 19 Dec 2002 01:40:21 +0100 (CET) From: Mark Message-Id: <200212190040.GBJ0EIT60331@asarian-host.net> Date: Thu, 19 Dec 2002 01:40:15 +0100 X-Authenticated-Sender: admin@asarian-host.net Subject: Re: Getting Perl scripts to work as mail filters X-Trace: e172nt6u6dog1ZlGm+CzNu+uv7yvvlLgaMKXMLqWDEhZ2kyJ/r3TXZMsrOHmTlBU X-Complaints-To: abuse@asarian-host.net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we are unable to process your complaint Organization: Asarian-host To: "Mxsmanic" , "Barry Byrne" , "FreeBSD Questions" References: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Auth: Asarian-host PGP signature iQEVAwUAPgEVdTFqW1BleBN9AQHGkwf+P8RKA1Yk2WAd4q65XBHWFLoaNsUIQQvL CtTZrvQ8+vyrpyLQkC1lvdgSgnqJ/evobFHwQbN9psUpBR68tj3q/iYV0B0m7qu0 mtA2Mi3LwslPDg/h0xgvUM4IECJVwMnLX/80aHfedRdQ2or7To834JzsEx3Q1Me5 ccm6taXVpaLXSs60u5gv0aERtXv16OZbJUApnxSVderimxb7by0cL9jpP2nnFV4j G/Y0CFfIbJ0TK/5w/n//1qsnAOHMe0BHpwAVlDxvB2sK/mwRrCDah/Ks99UHQtTx F4r0PI7GDJTDY6SVE4XQDeVYy+2VVP+joluN/hw2JW+U49o4SSYOtQ== =+8UO 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 ----- Original Message ----- From: "Mxsmanic" To: "Mark" ; "Barry Byrne" ; "FreeBSD Questions" Sent: Thursday, December 19, 2002 1:13 AM Subject: Re: Getting Perl scripts to work as mail filters > What about appending directly to the mailbox file under /var/mail/$USER > with the script? Possible, but not ideal. Be sure, in that case, you familiarize yourself with the assorted locking mechanism in question -- especially that of qpopper, for instance (if that is what you use to retrieve mail, of course), or mail may become lost. > It looks like the format of the file is very simple. Yes, standard mbox format. > Why wouldn't that work? It would, if done properly. :) > I don't know that calling sendmail again would be _that_ hard. Certainly possible (as has been suggested already, be careful you do not wind up in a loop, though). Like so, for instance: $mailprog = '/usr/sbin/sendmail'; open (MAIL, "| $mailprog -f$sender $recipient") || die $!; print MAIL "$header$body"; close (MAIL); The -f override is so the envelope sender will remain the original sender. Then you need to work a few things out with trusted users and all, to avoid "authwarnings" within the message. But a second invocation of sendmail from your Perl-script is sure possible. > 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? Headers are all part of the DATA stream, so they have no bearing on where sendmail delivers mail (unless you run sendmail with the -t option, which is generally ill-adviced anyway). The recipient given to sendmail as parameter (see above) is what will be used for delivery. No need to change the headers for that (as, like I said, they are part of the DATA stream). - Mark To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message