Try FEATURE(preserve_local_plus_detail)
in your .mc
file, and rebuild your .cf
.
This modifies ruleset 5 (localaddr
). It may cause side-effects (i.e. if your local mailer doesn't support +detail).
If this adversely effects your aliases lookup, then perhaps _FFR_ALIAS_DETAIL
is for you, this is a build time (i.e. not .cf
) option, I can't say I've tested it though. Not recommended ;-)
Failing that, the only way I can see of doing anything like you require with just user-controlled .forward
files is to check your confFORWARD_PATH
includes a path that has a $h
component. This should be the default since at least 8.12:
O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
This will allow a users to create say, ~/.forward.extra
to control where "user+extra" addressed email goes:
$ sendmail -v -d27.2 -bv elrond+foo
alias(elrond+foo)
alias(elrond+*)
alias(elrond)
alias(elrond)
forward(elrond+foo)
include(/home/elrond/.forward.thishost+foo)
include(/home/elrond/.forward+foo)
include(/home/elrond/.forward.thishost)
include(/home/elrond/.forward)
elrond+foo... deliverable: mailer local, host foo, user elrond
(You can see the forward files being handled by the include()
function ‒ it has no notion of expansion when it reads the files.)
FEATURE(virtusertable)
as suggested elsewhere is probably a better way to go, if you're the scripting kind you could collect user ~/.xforward
files periodically and build a master virtusertable.
sendmail -bv elrond+extra@localhost
without~elrond/.forward
file? [There are some special cases] – AnFi May 22 '13 at 17:20elrond+extra@this.box... deliverable: mailer local, host extra, user elrond
. But please give all variants in your hopefully upcoming answer, so that others with other variants will love that answer too. – Elrond May 22 '13 at 17:46P=xxx
after Mlocal line in your sendmail.cf. I have hoped forhost extra
because it most likely will simplify things a lot. I am not too good at brief explanations of advanced sendmailing ;-) – AnFi May 22 '13 at 19:22Mlocal
have any effect when.forward
is in effect? I highly doubt that. For the record: I haveFEATURE(local_procmail)
. So it's procmail in theMlocal
line. – Elrond May 22 '13 at 19:24+detail
is a feature of sendmail. If you have a user elrond, you will receive any mail onelrond+FOOBAR
for anyFOOBAR
. And I am writing .mc files for about 15 years now. :-) – Elrond May 22 '13 at 20:59