Wednesday 12 March 2014

How to flush mail queue in sendmail under linux?

How to flush mail queue in sendmail under linux?
If you want to do a one-off queue run:

[root@test ~]#sendmail -q       
It will process each message in the queue and forcefully send the queued mails (add the -v option for logging).

For checking sendmail logs
[root@test ~]#tail -f /var/log/maillog
[root@test ~]#mailq
/var/spool/mqueue is empty
                Total requests: 0
[root@test ~]#vi /var/spool/mqueue            — mail queue

How to flush sendmail queue under linux sendmail mailq command in linux how to flush mail queue in sendmail under linux
If you are worried about sendmail pending mail flush do the following two 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
[root@test ~]#sendmail -v -q                  
use 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 particular domain or user or recipient mail to delete use this command
[root@test ~]#sendmail -qS -v test.com
it will delete all mail from *@test.com
[root@test ~]#sendmail -qR -v hotmail.com                 

 It will delete all mail from recipient of hotmail.com.

1 comment: