Skip to main content

Delete All Default Email Address for All Users

Comments

5 comments

  • cPanelMichael
    Hello :) Email sent to the default address is stored in: /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.
    0
  • kamranonline
    Would you please tell me the FULL BASH command ? Thank you
    0
  • cPanelMichael
    There is no single command to use, but you could try something such as: 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.
    0
  • gfserver
    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
    0
  • cPanelMichael
    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: 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.
    0

Please sign in to leave a comment.