Filed under:

Ensim Mail Queue Problems - why are messages stuck in mqueue / mqueue.scanned / FILESYSTEMTEMPLATE/services/sendmail/ and how to process them...




Ensim Mail Queue Problems - why are messages stuck in mqueue / mqueue.scanned / FILESYSTEMTEMPLATE/services/sendmail/ and how to process them...

If you are finding your mail queues growing, or items left behind in mqueue and mqueue.scanned then you will need some handy little utils to help fix and analyse the probelms

Some of these scripts are donateware and if they have made your life a little easier we strongly suggest you thank the authors with a donation equivalent to the cost of your favourite pint - remember that technicians subsist on a diet of beer, pizza and gadgets.

Check which users have large mail queues ...

  • Sometimes a large site mail-queue will need deleting
    du -H /home/virtual/site*/fst/var/spool/mqueue.site | grep M
  • List all mail "stuck" in the main queue
    /scripts/vmqinfo -v
  • Delete anything undeliverable for more than a week
    /scripts/cmq -H -d '7 days ago'
  • Delete anything undeliverable after 15 errors
    /scripts/cmq -H -e -r 15
  • Delete any emails with a size of zero
    /scripts/cmq -H -z -e
  • Tidy mail queue of orphans headers with no mail-body
    /scripts/cmq -H -o

After using any of the above commands you will need to restart the various mail programs and helpers to recognise the changes in queue length...

  • service clamd restart
  • service spamassassin restart
  • service MailScanner restart
  • service sendmail restart

Now you know the standard mail queue has been cleaned up, force a manual queue run watching the output ...

  • sendmail -q -v

You can now start to "force" mail stuck in the mqueue.scanned folder from MailScanner/Virus/Spam checks ...

  • sendmail -q -OQueueDirectory=/home/virtual/FILESYSTEMTEMPLATE/services/sendmail/mqueue.scanned
    Each time it appears to "lock up" on a mail you need to manually remove the files for that email
    • rm -fr /home/virtual/FILESYSTEMTEMPLATE/services/sendmail/*/*{MAILID}
      where {MAILID} is the unique reference for that email (starting with m) - e.g. m284bA7k024170
    After a delete from the queue, you should restart sendmail and start the cleanup process again

You can get a list of the heavy mail users (relayers) ...

  • See all outbound mail senders for the last day:
    /scripts/vmail_search --relay-out --minutes 1440

If mail is taking a long time to be processed it may be that spamd or clamd are having a problem with one/more users mailboxes (normally caused by quota issues)

  • View details of SpamAssassin process
    lsof -nl | fgrep spamd | awk '{print $9}' | sort | uniq -c | sort -n
  • View details of ClamAV process
    lsof -nl | fgrep clamd | awk '{print $9}' | sort | uniq -c | sort -n
Kill the offending process, increase the users quota, then restart the services with
  • service clamd restart
  • service spamassassin restart
  • service MailScanner restart
  • service sendmail restart


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: