Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Delete All Default Email Address for All Users

Discussion in 'E-mail Discussion' started by kamranonline, Oct 28, 2013.

  1. kamranonline

    kamranonline Member

    Joined:
    Sep 16, 2012
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Newtowncenter
    cPanel Access Level:
    Root Administrator
    Hi,

    How its possible to delete ONLY emails in Default Email Account for all users of cPanel/WHM ?

    Is it possible to provide me SSH Command to remove all emails in cur , new of default account ?

    Thank you
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Email sent to the default address is stored in:
    Code:
    /home/$username/mail/cur
    /home/$username/mail/new
    You can delete all of this email through the use of a wildcard and the "rm" command.

    To note, you can ensure emails sent to non-existent email accounts are not delivered to the default address by ensuring your accounts set the "Default Address" to:

    "Discard with error to sender (at SMTP time)"

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. kamranonline

    kamranonline Member

    Joined:
    Sep 16, 2012
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Newtowncenter
    cPanel Access Level:
    Root Administrator
    Would you please tell me the FULL BASH command ?

    Thank you
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    There is no single command to use, but you could try something such as:

    Code:
    mkdir /root/email-to-delete
    mv /home/*/mail/cur/* /root/email-to-delete/
    mv /home/*/mail/new/* /root/email-to-delete/
    Then, simply delete "/root/email-to-delete" when you have confirmed the emails are no longer required.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. gfserver

    gfserver Member

    Joined:
    Feb 18, 2015
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Hi.. I've tried this method but I received this message
    -bash: /bin/mv: Argument list too long

    What can I do? I'm a newbie

    Apologize my bad english

    Thanks
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    I don't suggest using these types of commands if you are an inexperienced user. Have you checked to see if your hosting provider or data center can assist you with this? If they can't help you, try these commands:

    Code:
    mkdir /root/email-to-delete
    find /home/*/mail/cur/* -type f | xargs -i mv "{}" /root/email-to-delete/
    Remember this is going to remove all email from every account's default address.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice