Skip to main content

How to remove all emails from server via command line based on email subject line

Comments

5 comments

  • cPRex Jurassic Moderator

    Hey there!  I personally don't have a way to do this, and even if I did I'm not sure I'd be comfortable posting a 'delete all the emails' type of command in public.  I'm not sure if there is going to be a better option than the slow way you found.

    0
  • martin MHC

    Hi Rex,
    Thanks. I have found after posting this that doveadm requires specifying a mailbox for expunge actions, so I am going to try and build a system (probably perl script)  to read all the mailboxes on the server and then loop through each one removing messages with a certain criteria - in this case a subject line containing a spam message as found using the CPanel tool.

    Cheers

    0
  • martin MHC

    Hi again Rex,
    As a quick follow up - I have found from the /var/log/maillog file that over the last 2 days there have been almost 2,000 (1986) connections via:

     


    Oct 16 11:52:14 basic dovecot: imap-login: Login: user=<__cpanel__service__auth__imap__6aajhn0_p7ukexr2xanjz0sho4w3bjmtf5bii_2iygrrbg...>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=12339, secured, session=<OLbX3JUkqrp/AAAB>
    Oct 16 11:52:14 basic dovecot: imap(__cpanel__service__auth__imap__6aajhn0_p7ukexr2xanjz0sho4w3bjmtf5bii_2iygrrbgovfxc_m_uydqhzyyvb)<12339><OLbX3JUkqrp/AAAB>: Disconnected: Logged out in=11, out=519, bytes=11/519

     



    Is this normal, it seems quite excessive? What is this login doing? Thanks

    0
  • quietFinn

    Yes it's normal cPanel checking that IMAP is working, every 5 minutes.

    I would not call it excessive.

     

    1
  • martin MHC

    Thanks

    0

Please sign in to leave a comment.