• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Question Backup old mailbox to S3 and clear space

williamplk

Basic Pleskian
Server operating system version
Ubuntu 22.04.5 LTS
Plesk version and microupdate number
Plesk Obsidian 18.0.73 Update #5
Hi,

My users use IMAP and my server now 1T storage for mailbox on server, are there any method can I backup all user IMAP mailbox older then 1 year to S3 for cost saving?

Ex: Backup IMAP mailbox oder than 1 year to S3 then auto remove that successful backup mailbox file for space saving then if user need older data we can individual restore to the main mailbox.
 
There isn't any feature available in Plesk that archives and backups only old email messages. You'll have to create your own solution for that.

For example, what you could consider doing, is to
1) Configure S3 remote store for Plesk backups.
2) Configure a scheduled backup in Plesk to run monthly to only backup Mail Message to the S3 remote storage.
3) Create a custom Bash script that deletes all messages older than one year. For example:
Bash:
#!/bin/bash

for i in $(/usr/local/psa/bin/mail -l | sed '/^Alias/d' | tr '\t' ' ' | cut -d' ' -f 3-); do
    # Empty (expunge) message from inbox that are >= 1 old
    doveadm expunge -u "$i" mailbox INBOX after 365d

    # Empty (expunge) message from the Sent folder that are >= 1 year old
    doveadm expunge -u "$i" mailbox INBOX.Sent after 365d
done
4) Create a cronjob (Scheduled Task) to run the custom Bash script once a month after the backup has run.

A few things to be aware of when using this route:
  • This creates a lot of overhead, as each backup contains all current email messages too. So you need a lot of S3 storage, which will probably be expensive.
  • If for some reason the monthly backup fails, the messages will still be deleted and are lost if you have no other backup.
 
Back
Top