How to Delete Old Emails From Plesk Qmail

Written by ray padgett
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Delete Old Emails From Plesk Qmail
Deleting messages from Qmail requires running a deletion script. (Burke/Triolo Productions/Brand X Pictures/Getty Images)

If you run Plesk on your server, your server e-mail runs through Qmail. This program comes with Plesk and can be controlled from the Plesk dashboard. As e-mails build up, your server may start to slow down. You should periodically delete old messages from Qmail to free up space and allow the server to run smoothly. You can delete e-mails according to their dates.

Skill level:

Other People Are Reading


  1. 1

    Open the Plesk dashboard (contact your server admin if you are not sure how to access it).

  2. 2

    Click "Qmail."

  3. 3

    Click "Run script."

  4. 4

    Copy and paste the following into the text window:

    cd /var/qmail/mailnames; IFS="@"; \

    while read LINE ; do ADDR=( ${LINE} ); echo "${ADDR[0]}@${ADDR[1]}"; find ${ADDR[1]}/${ADDR[0]}/Maildir/ ( -path "/cur/" -o -path "/new/" ) ! -type d -mtime +XXXXXX | while read FILE; do DIR=$( dirname ${FILE} ); mkdir -p /path/to/dst/${DIR}; mv ${FILE} /path/to/dst/${DIR}; done; done < /path/to/address_file

  5. 5

    Replace "XXXXXX" with the number of days of e-mail you wish to keep. For instance, if you want to delete all e-mail older than a week, put in "7." If you want to delete all e-mail older than a year, put in "365."

  6. 6

    Click "Run."

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.