[EMAIL PROTECTED] wrote:
> We are shifting one of mail server from qmail to Exchange server
> for testing,

... my sympathies.  You'll be back.

> so how can i forward mails from qmail mail server to Exchange 
> server.

Look at the qmail-remote manual page.
  http://qmail.geto.net/man/man8/qmail-remote.html

If it's just POP mailboxes (not IMAP with subfolders), you can
push the messages out using qmail-remote.  Below are examples
of how to remail messages in people's folders.  Your script may
not end up being exactly the same, but it should give you an
idea as to qhat you need to do.

  #!/bin/sh
  PATH=/var/qmail/bin:/home/vpopmail/bin:$PATH # or whatever
  export PATH
  REMOTE=NEWSERVER.YOUR.DOMAIN
  [EMAIL PROTECTED]
  USERS="[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]"
  for user in $USERS; do
    dir=`vuserinfo -d $user`
    for subdir in new cur; do
      cd $dir/Maildir/$subdir || continue
      for msg in *; do
        qmail-remote $REMOTE $ADMIN $user < $msg
      done
    done
  done

If you just have one domain using qmail and not vpopmail,
just change directories to the domain and run:

  #!/bin/sh
  PATH=/var/qmail/bin:$PATH # or whatever
  export PATH
  REMOTE=EXCHANGE.YOUR.DOMAIN
  [EMAIL PROTECTED]
  for user in * do
    for subdir in new cur; do
      cd $dir/Maildir/$subdir || continue
      for msg in *; do
        qmail-remote $REMOTE $ADMIN [EMAIL PROTECTED] < $msg
      done
    done
  done

If you need to preserve IMAP subfolders, it gets more complicated.
You'd actually have to write (as Jeremy said) a Perl script using
Net:IMAP to push the message into their new mailboxes.  If it's just
a few users, each user can add the new IMAP account and just
drag/drop the messages into their new folders.

--
Eric Ziegast

Reply via email to