Date: Thu, 19 Dec 2002 01:13:17 +0100 From: "Mxsmanic" <mxsmanic@hotmail.com> To: "Mark" <admin@asarian-host.net>, "Barry Byrne" <barry.byrne@wbtsystems.com>, "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG> Subject: Re: Getting Perl scripts to work as mail filters Message-ID: <OE51Z9rWjAKYVpMmOlb00005e1f@hotmail.com> References: <NCBBIAMNAKDKFJIIGNPKGEGLKHAA.barry.byrne@wbtsystems.com> <OE31qwso6EsEWo2q0LZ00004187@hotmail.com> <200212182250.GBIMOPT39354@asarian-host.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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? ----- Original Message ----- From: "Mark" <admin@asarian-host.net> To: "Mxsmanic" <mxsmanic@hotmail.com>; "Barry Byrne" <barry.byrne@wbtsystems.com>; "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG> Sent: Wednesday, December 18, 2002 23:50 Subject: Re: Getting Perl scripts to work as mail filters > ----- Original Message ----- > From: "Mxsmanic" <mxsmanic@hotmail.com> > To: "Barry Byrne" <barry.byrne@wbtsystems.com>; "FreeBSD Questions" > <freebsd-questions@FreeBSD.ORG> > Sent: Wednesday, December 18, 2002 7:19 PM > Subject: Re: Getting Perl scripts to work as mail filters > > > > Heck, it's so simple I can list it here: > > > > --- > > #!/usr/bin/perl > > > > while ($inputline = <STDIN>) > > { > > $inputline =~ s/18 Dec 2002/29 Dec 2013/; > > print STDOUT $inputline; > > } > > --- > > > A bit too simple, perhaps. :) > > STDOUT is irrelevant to sendmail here; because, as far as sendmail is > concerned, your message has already been delivered, namely to the alias > "mymail". And your log says so: > > "to="|/usr/home/mymail/mailman", ctladdr=mymail (1/0)" > > Indicating that the "controlling address" (ctladdr) is "mymail". If your > recipient ("mymail") decides to output something, good for him, but sendmail > is long since done with the delivery. > > If you want to use filters, more or less like you describe, have a look at: > > Sendmail::Milter > > > get deposited in my mailbox on the server. From what I can understand of > > how this works, some program actually receives the messages from sendmail > > (?) and deposits them in my /usr/home/$USER mailbox > > For that to happen, in a set-up where the alias is to deliver mail for > "variable" users, you might, for instance, take a look at the "plussed > users" facility in sendmail. But why re-invent the wheel? A program like > procmail will more than likely do what you want. But even procmail, run from > a .forward scheme, suffers from having difficulty extracting the intended > recipient. Only if you define a Perl mailer can you solve that problem > entirely, as you can parse sendmail variables like $f and $u to your > delivery agent. > > - Mark > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > 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?OE51Z9rWjAKYVpMmOlb00005e1f>