This will do it:

| /home/vpopmail/bin/vdelivermail '' $[EMAIL PROTECTED]

>From qmail-command man page:

       SENDER  is  the envelope sender address.  NEWSENDER is the
       forwarding envelope sender address, as described  in  dot-
       qmail(5).   RECIPIENT  is  the envelope recipient address,
       local@domain.  USER is user.  HOME is your home directory,
       homedir.   HOST  is  the  domain  part  of  the  recipient
       address.  LOCAL is the local part.   EXT  is  the  address
       extension, ext.

>From the vpopmail source code of vdelivermail.c

    scopy(TheUser, getenv("EXT"), MAX_BUFF);
    scopy(TheDomain, getenv("HOST"), MAX_BUFF);

I tested it on my development machine and it worked.

Here is my .qmail-default file for my test.com domain

[root@orbital test.com]# more .qmail-default
| /home/vpopmail/bin/vdelivermail '' $[EMAIL PROTECTED] 

I'll send it mail:
[root@orbital test.com]# echo "to: [EMAIL PROTECTED]" |
/var/qmail/bin/qmail-inject

Here are the log entries:

<incoming message from qmail-inject>
964527972.765137 new msg 49884
964527972.765148 info msg 49884: bytes 206 from <[EMAIL PROTECTED]>
qp 7729 uid 0
964527972.770425 starting delivery 1: msg 49884 to local
[EMAIL PROTECTED]
964527972.770447 status: local 1/10 remote 0/20

<.qmail-default file is run and vdelivermail re-injects to
[EMAIL PROTECTED]>
964527972.955675 new msg 49885
964527972.955686 info msg 49885: bytes 303 from <[EMAIL PROTECTED]>
qp 7735 uid 501
964527972.960546 starting delivery 2: msg 49885 to remote [EMAIL PROTECTED]

<vdelivermail completes with it's "pop user doesn't exist" message>
964527972.960566 status: local 1/10 remote 1/20
964527972.962673 delivery 1: success:
POP_user_does_not_exist,[EMAIL PROTECTED]/did_0+0+1/
964527972.962702 status: local 0/10 remote 1/20
964527972.962713 end msg 49884

<the message to [EMAIL PROTECTED] completes>
964527973.004129 delivery 2: success:
209.218.8.20_accepted_message./Remote_host_said:_250_ok_964528032_qp_13757/
964527973.004161 status: local 0/10 remote 0/20
964527973.004172 end msg 49885




Andrew Hill wrote:
> 
> Hi,
> 
> I've got vpopmail 4.8a installed, and a virtual domain happily installed
> and working.
> 
> However, I now want to modify the .qmail-default file for this virtual
> domain (say normal.server.com) so that mail that is directed to an
> unknown virtual user gets delivered to another mail server
> (newmail.server.com).
> 
> Now, with qmail alone, the line:
> 
>   | forward "$LOCAL"@newmail.server.com
> 
> in ~alias/.qmail-default would do the trick.
> 
> However, in /home/vpopmail/domains/normal.server.com/.qmail-default is
> the entry:
> 
>   | /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox
> 
> If I modify this to read:
> 
>   | /home/vpopmail/bin/vdelivermail '' forward
> "$LOCAL"@newmail.server.com
> 
> then it would do exactly what I want, except for the fact that $LOCAL
> contains "normal.server.com-username", instead of the "username" that
> the newmail.server.com mail server is expecting.
> 
> Now, I could fix this with some perl, say call it domainStrip.pl:
> 
>   #!/usr/bin/perl
>   print(s/^normal\.server\.com-//);
> 
> but I'm not sure how to string it all together in .qmail-default for the
> virtual domain so that it tries to use vdelivermail, and if that fails,
> takes $LOCAL, pipes it into domainStrip.pl, and forward to the result
> @newmail.server.com.
> 
> Can anyone please help me complete it? I'm so close, I know it....
> 
> The other way that I can think to do the same thing is to have vadduser
> also create a .qmail-username file for each virtual user in that domain,
> where the .qmail-username file contains something like:
> 
>   ./username/Maildir/
> 
> That way, I can avoid trying to get the above perl stripping and
> forwading to work in combination with vdelivermail.
> 
> However, I understand that vpopmail may not always create each user in
> their own directory directly in
> /home/vpopmail/domains/normal.server.com/. Is that correct?
> 
> Or is there a simple way to do this that I've overlooked?
> 
> TIA,
> --
> 
> Andrew Hill

Reply via email to