* Rajkumar Andrews [linux-india] <27/04/01 04:59 -0400>:
> a) I have a linux box (box1) with Qmail on it. SMTP to this box works.
> b) I have then created a couple of virtual domains on this box.
> c) I have another linux box(box2) with a catchall (maildrop) account for a
> particular domain (xyz.com).
OK so far ...
> d) I want to download all emails from box2 onto box1 using fetchmail. After
> this I want to distribute the emails to the users who are on the virtual
> domain on box2 based on the virtual domain identity. Also I want that the
> virtual domain users be able to send out email and get replies back.
Again, OK. Quite easy. Configure sendmail on the local box to handle mail
for that domain (if all the users are on box2). If not, let the mails go out
to box 1. No hassles.
> What I am interested in knowing is how to tweak fetchmail to locally handle
> the emails? (I have tried procmail and maildrop -- unsucessfully!)
You need fetchmail in multidrop mode
defaults
forcecr
poll pop.server with proto pop3
user foo with pass bar is * here mda "/usr/sbin/sendmail -oem -f %F %T"
fetchall
On the remote box, you need to do a little aliasing like this (I'm talking
sendmail here, modify a bit for qmail)
> Quoting from http://www.sendmail.org/faq/section3.html#3.29 :
>
> Q3.29 -- How can I add a header specifying the actual recipient when having
> multiple users in a virtual domain go to a single mailbox?
>
> Stuffing multiple user's mail into a single mail box is not a good method of
> distributing user mail but if you must do this, the following solution should
> allow a tool like fetchmail to separate the messages for individual users.
>
> 1. Use FEATURE(local_procmail) in your .mc file so procmail (which you must
> install separately) will deliver mail to the mailbox.
>
> 2. Use FEATURE(virtusertable) to create a virtual user table entry for the
> domain as follows:
>
> @domain.com domuser+%1
>
> where domuser is the username of the mailbox you will be using.
>
> 3. Put this in the respective domuser's $HOME/.procmailrc:
> DOMAIN=domain.com
> ENV_TO=$1
>
> :0f
> * ENV_TO ?? .
> | formail -i "X-Envelope-To: "$ENV_TO@$DOMAIN
>
> :0fE
> | formail -i "X-Envelope-To: UNKNOWN"
>
> This will insert an X-Envelope-To header with the original envelope recipient
> address when the message is delivered the normal way via the virtusertable,
> and UNKNOWN if for some reason it was sent directly to domuser.
I believe qmail uses "minus" addresses instead of plussed addresses. In
sendmail, [EMAIL PROTECTED] is automatically delivered to user's mailbox -
the +foo is ignored by sendmail but can be parsed by, say, procmail.
OK right. Paraphrasing from the qmail faq:
In qmail, a ~/.qmail-default in the catchall-user's homedir will catch all
[EMAIL PROTECTED] addresses. Or you can touch ~/.qmail-user1,
~/.qmail-user2 etc to catch specific [EMAIL PROTECTED] etc addresses and
bounce the rest (assuming you have set up something like domain.com: catchall
in /var/qmail/control/virtualdomains, and put the corresponding entry into
the rcpthosts file).
If you already use '-' in usernames, you need to change the delimiter to
another character (preferably + ... qmail seems to want to do everything
"opposite" to sendmail) :)
This is done at compile time. Version 1.00, change the value of
USEREXT_BREAK in conf-unusual.h. Version 1.0x, change the file "conf-break".
Without this a user called "me-too" would mask some of the suffix space for a
user called "me".)
All said and done, catchall mailboxes for a domain are, at best, an ugly
kludge. Best bet is to set up ETRN or UUCP to handle mail for that domain.
-s
--
Suresh Ramasubramanian <--> mallet <at> efn <dot> org
EMail Sturmbannfuhrer, Lower Middle Class Unix Sysadmin
----------------------------------------------
Find out more about this and other Linux India
mailing lists at http://lists.linux-india.org/