Creating a backup of incoming mail

Robert Schetterer rs at sys4.de
Tue Sep 2 07:26:36 UTC 2014


Am 01.09.2014 um 18:20 schrieb LuKreme:
> 
> On 01 Sep 2014, at 01:33 , Patrick De Zordo <patrick at spamreducer.eu> wrote:
> 
>> To backup all mail (incoming and outgoing), BCC all mails, you could do the following..
>>
>> Add to your "/etc/postfix/main.cf" the following:
>> ---8<-------------------------------------------------------------------------------------
>> # Auto-Backup all mails
>> transport_maps = hash:/etc/postfix/transport
>> backuplmtp_destination_recipient_limit = 1
>> lmtp_destination_recipient_limit = 1
>> recipient_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
>> sender_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
>> ---8<-------------------------------------------------------------------------------------
>>
>> Create a domain called "backup.local" in postfixadmin or whatever you use to edit your accounts..
>>
>> Add every domain for which you like to activate incoming backup to " /etc/postfix/backup_bcc.pcre":
>> ---8<-------------------------------------------------------------------------------------
>> /^(.*)@spamreducer\.eu$/      spamreducer.eu at backup.local
>> ---8<-------------------------------------------------------------------------------------
>>
>> Add to your "/etc/postfix/master.cf" the following:
>> ---8<-------------------------------------------------------------------------------------
>> backuplmtp      unix  -       -       n       -       -       lmtp
>> ---8<-------------------------------------------------------------------------------------
>>
>> Add to your "/etc/postfix/transport" the following:
>> ---8<-------------------------------------------------------------------------------------
>> [backup.local] backuplmtp
>> ---8<-------------------------------------------------------------------------------------
>>
>> Don't forget to issue " postmap /etc/postfix/transport"..
>>
>> For making folders based on "year/month" you have to use an appropriate sieve script.
>>
>> Give me a feedback!
> 
> Wow, that is a whole lot more work that what I did with procmail which was practically one line in the /usr/locale/etc/procmailrc right at the top.
> 
> YER=`date %Y`
> MON=`date %m`
> 
> :0c
> /backup/mail/$YER/$MON/

see

https://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/

sorry german


with listescape plugin enabled something like

require
["reject","variables","date","fileinto","mailbox","envelope","subaddress","regex","copy","include"];
# Extract date info
if currentdate :matches "year" "*" { set "year" "${1}"; }
if currentdate :matches "month" "*" { set "month" "${1}"; }
if currentdate :matches "day" "*" { set "day" "${1}"; }
if envelope :detail :matches "to" "*" { set :lower "to" "${1}"; }
if true {
if header :contains "Return-Path" "${to}@domain.de" { fileinto :create
"user-backup/${year}/${month}/${day}/${to}/out";}
else { fileinto :create "user-backup/${year}/${month}/${day}/${to}/in";}
stop;
}


> 
> I'll start with Sieve (though I still haven't used it) and see what that can do, but this at least I can do, if sieve proves too annoying to get going.
> 



Best Regards
MfG Robert Schetterer

-- 
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein


More information about the dovecot mailing list