I want a local mail delivery agent to put the incoming message (for outside or
between the virtual domains) in the right directory (i think it is the
solution,isn't it?)
Is there any possibilities to set Procmail to do that ? Or can you point me in
the right direction ?
Hi Vincent,
Ideally, this type of thing is best handled by the MTA, only calling the
local delivery agent once the target has been sorted out.
If you're using sendmail as your MTA, I strongly recommend looking at
the sendmail web page about it:
http://www.sendmail.org/virtual-hosting.html
For the benefit of the list's readership (and to prove how horribly wrong
it is to use procmail for this), here's how I used to do it in procmail
before sendmail did virtual domains. I sent this to the comp.mail.sendmail
newsgroup a while back:
If you really HAVE to use procmail, then the easiest way is to
create a user that spans multiple domains (i.e. webmaster). Create
a ~/.procmailrc that looks like:
:0 c:
webmaster-messages
#### domain1.net
:0
* ^TO(_dot_)*(_at_)domain1(_dot_)net
| sed 's/your.real.server/domain1.net/g' | /usr/lib/sendmail
-C$HOME/domain1.cf `cat domain1-list`
:0
* ^Received: (_dot_)*for(_dot_)*(_at_)domain1(_dot_)net(_dot_)*
| sed 's/your.real.server/domain1.net/g' | /usr/lib/sendmail
-C$HOME/domain1.cf `cat domain1-list`
#### domain2.org
:0 h c
* ^Received: (_dot_)*for(_dot_)*(_at_)domain2(_dot_)org(_dot_)*
* !^FROM_DAEMON
* !^X-Loop: webmaster(_at_)domain2(_dot_)org
| (formail -r -A"Precedence: bulk" \
-A"X-Loop: webmaster(_at_)domain2(_dot_)org" \
-A"From: webmaster(_at_)domain2(_dot_)org" ;\
cat "$HOME/domain2.reply") | $SENDMAIL -t
:0
* ^TO(_dot_)*(_at_)domain2(_dot_)org
| sed 's/your.real.server/domain2.org/g' | /usr/lib/sendmail
-C$HOME/domain2.cf `cat domain2-list`
:0
* ^Received:.* for(_dot_)*(_at_)domain2(_dot_)org(_dot_)*
| sed 's/your.real.server/domain2.org/g' | /usr/lib/sendmail
-C$HOME/domain2.cf `cat domain2-list`
Each domain has three files: a .cf file, a list of recipients, and, if an
auto-responder is activated, a response file. The .cf files are all
the same with the exception of the masquerade as line:
domain1.cf has DMdomain1.net
domain2.cf has DMdomain2.com
This is sorta kind from memory and old config files that I don't use
anymore (upgraded to virtuser), so it may not be perfect. Let me
know if this doesn't make sense.
Have fun.
Chris