KP Solutions

Solutions for Day to Day Technical Problems

How to clear sendmail queue

| 4 Comments

If you ever felt the need of flushing the sendmail queue then this post will be handy to you.

How to flush sendmail queue under linux sendmail mailq command in linux how to flush mail queue in sendmail under linux

If u r worried about sendmail pending mail flush do the following 2 things.

1) manually method –> delete /var/spool/mail/*.* files in this dir –> delete /var/mqueue/*.* files

then check if all mail gone using mailq command. all mail will be deleted.

2) using command:

use simple command sendmail -v -q in root prompt. it will flush all pending mails. rest to confirm u can run mailq command if all are really gone !!….

3) if u want perticular domain or user or recepitience mail to delete use this command

sendmail -qS -v test.com it will delete all mail from *@test.com

sendmail -qR -v hotmail.com it will delete all mail from recepient of hotmail….

Cheers!!

Ketan

  • vishesh

    Good commands here thanks. Can you suggest command to delete all deferred mail from sendmail queue. Even after cleaning mqueue some deferred mail apear and apear again.

  • http://www.eclassifieds4u.com Ketan Patel

    If you have cleared mail queue and you still see some deferred mails, then it means that some script is still pumping out mails constantly.

  • Princemau

    use exim

  • Trever+disqus

    Doesn’t delete anything, just processes it immediately.