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.

Delete All Default Email Address for All Users

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

  1. kamranonline

    kamranonline Member

    Joined:
    Sep 16, 2012
    Messages:
    8
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. kamranonline

    kamranonline Member

    Joined:
    Sep 16, 2012
    Messages:
    8
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  5. gfserver

    gfserver Registered

    Joined:
    Feb 18, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page