Email Server - Folder Scan and copy to another account and folder

Discussion in 'Server Operation' started by Richard Franklin, Apr 1, 2016.

  1. Richard Franklin

    Richard Franklin New Member

    I use scrollout F1 as my mail scanner and I am very happy with the blocking that it provides. If you have used it you know that you have a collector email address that you make a bad and good folder. Bad emails are learned and blocked and the good are resent to the original recipients. What I would like to do is have a bad folder in every mail box and some sort of spider that only crawls the bad folder and then copy's to my main collector email box. Anyone know of anything like this ?
     
  2. imort

    imort New Member

    Not sure what do you need actually.
    Maybe you can just configure redirect from your mailboxes to the main mailbox and then let your mail scanner do it work?
     
  3. sjau

    sjau Local Meanie Moderator

    well, I think that sounds rather simple to do.

    Assuming you have all email boxes of all people storde in /var/mail

    Then you could run script like this:
    Code:
    #!/usr/bin/env bash
    find /var -ipath "*mail/*" -type f -exec cp '{}' /path/to/new/dir/ \;
    
    but for testing with the real cp command, maybe better to use:

    Code:
    find /var -ipath "*mail/*" -type f -exec echo" cp '{}' /path/to/new/dir/" \;
    
    NOTICE: I didn't test that code! So be carefull! Also you'll need to fix permissions of the copied files. This is just some idea on how you can accomplish that.
     

Share This Page