The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove all [System] mails from mailqueue?

Discussion in 'E-mail Discussions' started by postcd, Aug 12, 2014.

  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    How to remove all queued exim mails where sender is [System] ?
    or all queued emails which body contains certain phrasse?

    i have WHM root access

    (via command line preferably)

    ---
    This command removed somethins and is claimed to "removing failed delivery messages to (likely) non-existent senders: "
     
    #1 postcd, Aug 12, 2014
    Last edited: Aug 12, 2014
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    thx, but i did not found command that would do this on above mentioned url.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    The URL I referenced shows:

    Thank you.
     
  5. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    watch the text bellow that command:
    "If you are deleting these files directly, YOU ARE DOING IT WRONG! Use the appropriate exim command to properly deal with the queue."

    im unsure what does it mean, but i dont know how to use above command to delete the messages containing before mentioned phrasse
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It's stating that it's better to use a command such as "exim -Mrm" (As in the example) than to use "rm" to directly remove messages from the directory.

    Thank you.
     
  7. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    what is the command to remove [System] sender emails?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    One command to use would be:

    Code:
    exiqgrep -i -f '<System>' | xargs exim -Mrm
    However, you should replace "System" with the actual "FROM" address if you notice it's different. Please keep in mind that users will not always simply provide you with the exact commands to use. Often times, you will get referred to documents or third-party websites where you must formulate those commands on your own.

    Thank you.
     
  9. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    Yours mentioned command says:
    "exim: no message ids given after -Mrm option"
    but i dont know these ids, i want to delete all that match the mentioned [System] phrasse. From WHM queue manager i can filter based on Sender/Recipient, but when i enter System or [System] it dont shows anything even there is alot of them in queue.
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Right, review a message header, and look to see where the "FROM" address stems from. You can replace "system" with that "FROM" address in the command I provided.

    Thank you.
     
  11. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    620
    Likes Received:
    6
    Trophy Points:
    18
    my queue is now empty so i cant get message header as you suggest..

    i think i can get it like:

    exim -bp

    then i know messageID, so i do:

    exim -Mvh messageID

    but FROM addresses are random ones, its generated by spam script. so are you sure your advice will be working there?

    I have not found on how to delete example all emails containing certain phrasse in body, or i found example account name forumhea was abused so i found in spam mail

    so you see "-helo_name subdomain.mydomain.net" (i replaced so its hidden what is real domain name), which identiffied abuse account which is sending spam emails.. so not sure if i can list/delete mails based on this value "-helo_name XYXY"?

    there are some handy exim commands
     
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can always play around with the "exiqgrep" command to see the results without deleting the messages. EX:

    Code:
    exiqgrep -i -f '<System>' 
    This leaves out the removal part of the command, so you can test out different strings and see which one works best for you before actually adding in the removal aspect.

    Thank you.
     
Loading...

Share This Page