Posted By

berkes on 12/13/06


Tagged

Bash postfix mail-backup


Versions (?)

Move all mails with a certain subject into a backup dir.


 / Published in: Bash
 

Move all mails with a certain subject (in this case starting with the word "Undelivered" into a backup dir. It is by no means a mail filter, I needed it to clean out the maildirectory after a HDD crash wich caused over 1000000 (one million) local bouces and thus Undelivered mails and stuff.

  1. for file in `grep -lr 'Subject: Undelivered' /path/to/Maildir/cur`;
  2. do
  3. mv $file /path/to/backup/;
  4. done

Report this snippet  

You need to login to post a comment.