Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2002 23:50:45 +0100
From:      Mark <admin@asarian-host.net>
To:        "Mxsmanic" <mxsmanic@hotmail.com>, "Barry Byrne" <barry.byrne@wbtsystems.com>, "FreeBSD Questions" <freebsd-questions@freebsd.org>
Subject:   Re: Getting Perl scripts to work as mail filters
Message-ID:  <200212182250.GBIMOPT39354@asarian-host.net>
References:  <NCBBIAMNAKDKFJIIGNPKGEGLKHAA.barry.byrne@wbtsystems.com> <OE31qwso6EsEWo2q0LZ00004187@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
----- 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




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