[Users] Wiped out my Inbox - Recovery?

Pierre Fortin pf at pfortin.com
Sat Apr 23 06:23:38 CEST 2016

On Fri, 22 Apr 2016 20:14:57 -0700 John Jason Jordan wrote:

>Considering things further, is there a way to configure Claws-Mail to
>back up folders automatically? 

Simple rule to backup every message as they arrive into a single backup

  enabled rulename "Backup" all copy "#mh/Mailbox/Backup"

OTOH, I filter all my messages as they arrive. To backup only those within
certain filtering rules, I could add something like:


to those rules (all on one line in .claws-mail/matcherrc).  e.g.,

  enabled rulename "Foo" from matchcase "foo.com"
   copy "#mh/Mailbox/Backup/Foo"
    move "#mh/Mailbox/Foo"

See also:

To get even more creative, you could use "execute" and write your own in
your favorite scripting language...

Or, via cron at say, 3:15 AM every day; add:

   15 3 * * * cp -auf /home/<user>/Mail <backup_directory>

into your crontab. <backup_directory> can be anywhere, including external
USB drive/flash, NFS, etc...  

To prevent files being copied to your local drive when an external drive
is not currently mounted, add this to the mount point:

   # chattr -i <mount_point>

This will ensure that your backups go to a mounted drive only; and can
never be written to a bare mount point.

From "man chattr":
  A file with the 'i' attribute cannot be modified: it cannot be deleted
  or renamed, no link can be created to this file and no data can be
  written to the file.  Only the  superuser or a process possessing the
  CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

There are many other possibilities; but K.I.S.S. is often best or good
enough...  :)

BTW, backing up full folders, such as those where you save sent messages
will require more thought; but it's late and I've been working a very
long day... 


More information about the Users mailing list