foo+bar@ addresses, procmail, and postfix
Dan Langille
dan at langille.org
Wed Apr 9 03:52:03 PDT 2003
On 8 Apr 2003 at 17:42, Terry Lambert wrote:
> Dan Langille wrote:
> > I'm trying to get foo+bar at example.org addresses to work with
> > procmail. My MTA is postfix. I've had a hard time tracking down
> > the information and trial and error has gotten me a working
> > solution. I'm wondering if there is a better way to accomplish
> > this[1].
>
> You should look at the "Cyrus" mailer.
>
> For "plussed" addresses, your MTA/MDA should not consider the
> portion following the "+" as part of the local address, when
> doing local address validation, user validation, account
> validation, etc.. But it should pass the portion following
> the "+" to the MDA/local delivery agent, IFF the local delivery
> agent understands "plussed" addresses. The Cyrus "deliver"
> program (the MDA that comes with the Cyrus distribution) takes
> that portion as an additional command line argument, in the
> normal case.
That is what is occuring now.
> I don't know what procmail is/isn't willing to take as additional
> command line arguments (normally, I use Sieve, not procmail, so that I
> can automatically direct the mail to a specific IMAP4 mailbox as a
> result of the plussed addresses and/or Bayesian filtering, etc.,
> without giving users the ability to run code on my systems), but you
> could always stuff it in the environment before invoking procmail, if
> that was the only way to get procmail to see it.
In the URL I quoted, it shows what Postfix supplies via environment
variables.
> But either way, you need to modify the MDA invocation by the MTA, on
> local delivery.
Done. And how I did that was in my original message.
> I can tell you how to do this with sendmail ("Look at the Cyrus
> mailer!" 8-)), but I don't know the answer for Postfix or Qmail,
> or if it's even possible (Sendmail is cool! 8-) 8-)).
I can tell you.... see my OP.
> > This type of addressing is often referred to as address extensions.
> > I found one clue at http://pm-doc.sourceforge.net/pm-tips-
> > body.html#using_plus_addressing_foobar. My problem was that I could
> > not get the "bar" bit of the address. But the above URL mentions:
>
> That's because mail.local doesn't take or pass on optional
> arguments to programs invoked in .forward files. It's an
> MDA that doesn't support that.
But Postfix does.
> There are "mail.local" replacements available on the net,
> but if you use them, you need to replace the MTA/MDA interface,
> since it expects to be able to send to multiple local users,
> simultaneously. The normal way to disable multiple users
> simultaneously in sendmail is to remove the "m" flag on the
> "local" mailer.
I'd rather disturb the existing setup as little as possible.
> > Any comments? Ideas? Improvements?
>
> Don't run procmail globally. Replace your mail.local, if you
> need to, but don't run procmail globally.
I'm the only user on this system. I'd rather not replace mail.local.
FWIW, I'm taking cvs-all mail and pumping it to multiple copies of
the Fresh{Ports|Source} database. The procmail script I use is
something like this:
# a file of the form YYYY.MM.DD.HH.MM.SS.PID.txt
#
FILE=`date +%Y.%m.%d.%H.%M.%S`.$$.txt
ARG = $1
:0
* ARG ?? ^^dev^^|^^test^^
{
MSGDIR=$HOME/FreshPorts/$ARG/msgs/FreeBSD
TMPDIR=$MSGDIR/spooling
:0c :
$MSGDIR/raw/$FILE
:0 :
| cat > $TMPDIR/$FILE && \
mv $TMPDIR/$FILE $MSGDIR/incoming/$FILE
}
The above ensures the messages wind up in the appropriate directory
(i.e. under $HOME/FreshPorts/{dev|test}/msgs/FreeBSD). A copy goes to
raw and another one goes to a spooling directory and is then moved to
an incoming directory where it is picked up by another "daemon".
--
Dan Langille : http://www.langille.org/
More information about the freebsd-chat
mailing list