Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Sendmail to Qmail migration

by | Jul 13, 2006

This article explains how to migrate email accounts/mailboxes from a sendmail server to a Qmail server. A challenging task for any sysadmin implementing a Migration would be to migrate all the email accounts from one Mail server to another preserving all the settings, such as usernames and passwords.

This document helps you, only if your Qmail system is installed with VpopMail (not VmailMgr). Installing and configuring qmail+vpopmail is out of the scope of this article.(Refer to and to install Qmail and Vpopmail) This article exclusively covers only the Migration aspects.

Here is what you have.

* Sendmail server, the list of usernames, the corresponding system passwords (encrypted, not clearpasswords) and the Mailboxes
* Qmail server with VpopMail.

Create Mailboxes in the new server.

The first step is to create all email accounts in the new server. In order to do this,
collect the usernames and encrypted passwords from the old server. There is no way you could
get the clear password from a sendmail system, so we collect the encrypted passwords.
Before adding the email accounts, let me explain to you some features of the VpopMail binaries.
Suppose you installed VpopMail in the path $VPOPMAILHOME, say /home/vpopmail, you can find all the VpopMail binaries in $VPOPMAILHOME/bin directory.

# cd $VPOPMAILHOME/bin/<br /><br />

1. vadddomain – is used to add a domain into qmail server.

2. vdeldomain – delete a domain from the qmail system.

3. vchangepw – to change the password of an email account.

4. vmoduser – to modify a user account.

5. vsetuserquota – to set the quota of an email account

6. vadduser – to add email accounts in the server.

7. vchkpw – the password verification module.

8. vdominfo – display the details of a domain, including passwords.

9. vpasswd – change password of a user account

10. vuserinfo – display the email account information, including the encrypted and clear password.

You can easily manage domains and email accounts in a Qmail server using these binaries. We are going to use the vadddomain and the vadduser binaries to add domains and email accounts.

First add the domain into the server into the Qmail system.

# ./vadddomain
Please enter password for postmaster:
enter password again:

Then add emails accounts using the following format. The “-e” option is used to pass the encrypted password to vpopmail.

#vadduser -e '$1$yt5hE5rz$NXn6X6t29ci/8CYk4S44d.'
#vadduser -e '$1$6io3bpHS$ALqBpZbsrXI2YVTQDeG0S.'
#vadduser -e '$1$6io3bpHS$ALqBpZbsrXI2YVTQDeG0S.'

In order to make our job easier, the usernames and passwords that we build on the old server will be formatted as a series of commands, like the example above. For example, the file “” now contains a series of commands.

vadduser -e '$1$yt5hE5rz$NXn6X6t29ci/8CYk4S44d.'
vadduser -e '$1$6io3bpHS$ALqBpZbsrXI2YVTQDeG0S.'

Copy this script “” to the new server’s $VPOPMAILHOME/bin location and execute it.

# sh +x

Half of our job is now completed. All emails accounts for the domain “” are now added to the new server. At this point, the end users will be able to access POP3 or IMAP server on the new machine, they would be able to log into their mailboxes, but they would see an empty box, rather than seeing whatever messages were on the old server.

Sendmail uses the traditional Unix mailbox format called “mbox” (where the entire mailbox is one file, Migrating the Sendmail mailbox with the messages stored one after the other) to store the emails, While Qmail uses the “Maildir” format
to store the emails. This step actually copies the contents of the mailboxes from the sendmail machine to the qmail machine, converting the messages from sendmail’s “mbox” format to qmail’s “Maildir” format.
The tool used to convert mbox to MailDir, is called mbox2mdir or mb2md.

You can download mb2md from

First copy the Mailbox from the old server to the new server, then run the following command from shell.

#mb2md -s MailBoxfile -d /home/vpopmail/domains/$username/Maildir/

( replace $username with original username)

There it is. You are done…. now relax and enjoy Mail server administration.

Qmail Administration Tools

qmail-qstat – qmail-qstat is a binary installed along with the qmail server.
This command will show you how many messages are in the queue, even while qmail-send is not runnning.

messages in queue: 3037
messages in queue but not yet preprocessed: 23

From the output, you can find how many mails are in the server, and how many mails are there yet to be processed. If there are lots of mails in the server, those are probably the frozen/bounced messages.

Qmail-qread will list all messages in the queue with to address
QmHandle – qmhandle is a great tool to manage your qmail queue. Key features are colored output and the ability to view and delete messages from the queue.

You can download this tool from

* You can read the qmail queue ( the qmail-read program with qmail server does the same
but the output of qmHandle is improved over qmail-qread. #qmHandle -l
* You can print queue statistics . #qmHandle -s
* You can view a message in the queue;

#qmHandle -vN ( Where N is the message number)

* You can remove one or more messages from the queue;

#qmHandle -dN ( Where is the message number to be removed )

#qmHandle -D ( delete all messages in the queue)

#qmHandle -tX ‘string’ ( delete all messages with matching headers, where string to match and X specifies:

‘f’ : Who the message is from,

‘t’ : Who the message is to; or,

‘s’ : What the message’s subject is #qmHandle -M ( delete all msgs in the queue from MAILER-DAEMON@hostname)


qmail-repair is a tool to repair a damaged mail queue or building a
mail-queue from scratch. It is written in python.

Download at

# python -r ( repair the mail queue )
# python -c ( force creation of mail queue )
# python -t (Testing queue, do not modify queue)

About the author:
Aneesh P. K has worked in Bobcares for over 2.3 years as System Administrator. He manages Internet servers in Linux and Windows running Cpanel, Plesk, Qmail, Apache and IIS software.



  1. Nice article !!

  2. Hello,
    Thanks for the article. i want to export my emails from a sendmail server to am SME server that uses Qmail.
    Can you help me as to how to go about it.

    Thank you

Privacy Preference Center


Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid


Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.