Delete Mail Queue using SSH?
I have one account send a lot spam mail
there are lots mail in Queue
I want use ssh to delete that without stop exim service
-
If you know the envelope-sender of whoever is sending the messages you can list all of those message ids with: exiqgrep -if %envelope-sender% That will list all message ids that contain %envelope-sender%. I would encourage you to review these messages and make sure that you really want to remove them from the mail queue, because piping this list of message ids through exim to remove the messages, will remove the messages. There is no going back after you remove a message from the mail queue, so I really stress extreme caution when removing messages from the mail queue. To remove the message ids that match this envelope-sender you would use: exiqgrep -if %envelope-sender% | xargs -n1 exim -Mrm But I really, really encourage extreme caution with this because once they are removed, they are gone. exim -Mrm %messageid% Will remove %messageid% from the mail queue. xargs -n1 is taking each message id you get from the exiqgrep -if %envelope-sender% command and passing it as the next argument to exim -Mrm. Essentially exim -Mrm %messageid1%, exim -Mrm %messageid2%, exim -Mrm %messageid3%.... 0 -
If you know the envelope-sender of whoever is sending the messages you can list all of those message ids with: exiqgrep -if %envelope-sender% That will list all message ids that contain %envelope-sender%. I would encourage you to review these messages and make sure that you really want to remove them from the mail queue, because piping this list of message ids through exim to remove the messages, will remove the messages. There is no going back after you remove a message from the mail queue, so I really stress extreme caution when removing messages from the mail queue. To remove the message ids that match this envelope-sender you would use: exiqgrep -if %envelope-sender% | xargs -n1 exim -Mrm But I really, really encourage extreme caution with this because once they are removed, they are gone. exim -Mrm %messageid% Will remove %messageid% from the mail queue. xargs -n1 is taking each message id you get from the exiqgrep -if %envelope-sender% command and passing it as the next argument to exim -Mrm. Essentially exim -Mrm %messageid1%, exim -Mrm %messageid2%, exim -Mrm %messageid3%....
Thanks for reply but have a problem here when I type exiqgrep -if %sender% or exim -bpc system respon response command not found0 -
You've either got something messed up with your PATH variable or you don't have exim installed. If it's the latter then you have other, more pressing issues. Are you accessing the server as root? Do you have root access to the server in question? 0 -
Hello, You could also try searching for messages you want to remove via "WHM >> Mail Queue Manager". There's a "Delete All" button that allows you to delete all of the messages from the search results. Thank you. 0 -
Hello, You could also try searching for messages you want to remove via "WHM >> Mail Queue Manager". There's a "Delete All" button that allows you to delete all of the messages from the search results. Thank you.
Thanks cPanelMichael just loading heavy can't open WHM . So I want use console to delete queue. But that problem has resolve . $Path not include /usr/sbin but I can use direct command /usr/sbin/exim -bpc to use this0 -
Hi @webdsn, I'm glad to see you were able to get the command working. Let us know if you have any additional questions. Thank you. 0
Please sign in to leave a comment.
Comments
6 comments