Linux Administrator

How to Implement Multiple Mail Queues in Sendmail

By default Sendmail use a single mail queue. If you don’t have any special requirement you will not care about this but if you have high traffic mail servers it might be useful to split the queue into several directories, because thousands of files in a single directory will become performance penalty at some time and also processing the queue sequentially will become very slow.

In this article I will show you how to implement multiple mail queues in Sendmail.

Implement Multiple Mail Queues in Sendmail

Suppose we want to use 5 mail queue directories. First of all you have to create the directories because sendmail does not create it by default.

# mkdir /var/spool/mqueue/q{1,2,3,4,5}

Next change the ownership of all create directories like below.

# chown -R smmta:smmsp /var/spool/mqueue/q*

Once ownership changed now you need to enable the multiple queues in the sendmail configuration file. Edit the sendmail.mc found it under /etc/mail/ and append the below line.

define(

QUEUE_DIR’,

/var/spool/mqueue/q*')dnl

Follow the below command to regenerate sendmail.cf file.

# m4 sendmail.mc > /etc/mail/sendmail.cf

Next restart the sendmail service it will start using the multiple queues we defined. Running mailq will output each of the queues.

# mailq
/var/spool/mqueue/q6 is empty
/var/spool/mqueue/q4 is empty
/var/spool/mqueue/q3 is empty
/var/spool/mqueue/q2 is empty
/var/spool/mqueue/q5 is empty
Total requests: 0
If you would like to add more directories to the configuration, you need to create the respective directories and set the appropriate permissions and restart sendmail again.

If you had existing mails in the queue (most likely if you were looking for this solution), if you want them still processed, move them from /var/spool/mqueue in one of the newly created queues (q1 for ex).

Individual queue directories can be symbolic links to other partitions to spreads load among multiple disks. Queue IDs are unique across queues so you can move the items among queues if you have to.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment