Moving the mail queue

When a host goes down for an extended period, many messages routed to (or through) that host might be stored in your mail queue. As a result, the sendmail command spends a long time sorting the queue, severely degrading your system performance. If you move the queue to a temporary place and create a new queue, the old queue can be run later when the host returns to service.

To move the queue to a temporary place and create a new queue:

  1. Stop the sendmail daemon by following the instructions in Stopping the sendmail daemon.
  2. Move the entire queue directory by entering:
    cd /var/spool 
    mv mqueue omqueue
  3. Restart the sendmail daemon by following the instructions in Starting the sendmail daemon.
  4. Process the old mail queue by entering:
    /usr/sbin/sendmail -oQ/var/spool/omqueue -q
    The -oQ flag specifies an alternate queue directory. The -q flag specifies to run every job in the queue. To get a report about the progress of the operation, use the -v flag.
    Note: This operation can take some time.
  5. Remove the log files and the temporary directory when the queue is empty by entering:
    rm /var/spool/omqueue/* 
    rmdir /var/spool/omqueue