I'll try to make that way today! Thanks for the advice! 2009/2/3 mouss <mo...@ml.netoyen.net>
> Gabor Hasenfrasz a écrit : > > Dear All, > > > > A company asked me to configure an archiving system on a postfix server. > > After a little i've made a choice to maildrop as an archiving solution. > > I've configured main.cf <http://main.cf> to forward mails to a virtual > > user which will be the collector. I've made a transport map to use > > maildrop for this user. I've successful made the archiving for outgoing > > emails: > > > > if ( /^From:\s*(....@domain.com <http://domain.com>)/ ) > > { > > ADDR=getaddr($MATCH1) > > ADDR=`echo $ADDR| sed '/^.*$/N;s/\r//g'` > > `test -e /$DEFAULT/.${ADDR}SENT` > > if ( $RETURNCODE != 0 ) > > { > > `maildirmake -f "${ADDR}SENT" $DEFAULT` > > `chmod -R 0700 "/$DEFAULT/.${ADDR}SENT"` > > } > > to "$DEFAULT/.${ADDR}SENT" > > } > > > > do not use headers. use the envelope. if you insist on using maildrop, > run it with -f ${sender} and use $FROM. > > > It drops the email to the virtual user's folder which is collecting the > > emails and they will use to restore emails if something happens. > > > > But with the incoming mails i have problem. There are cases when the > > sender sends the email for about 30 email accounts. In this case what > > can i do? I've seen in the document that there are foreach statement but > > i can't figure it out how should i use it. > > > > foreach ( /^To:\s*(....@domain.com <http://domain.com>)/ ) > > do not use headers. > > you should take time to read about envelope addresses. mail transport > doesn't rely on headers. > > > { > > ADDR=getaddr($MATCH1) > > foreach $ADDR > > { > > `test -e /$DEFAULT/.${ADDR}INBOX` > > if ( $RETURNCODE != 0 ) > > { > > `maildirmake -f "${ADDR}INBOX" $DEFAULT` > > `chmod -R 0700 "/$DEFAULT/.${ADDR}INBOX"` > > } > > cc "$DEFAULT/.${ADDR}INBOX" > > } > > } > > In this case nothing happens. I've made a config where it could make a > > folder like us...@domain1.com <mailto:us...@domain1.com> > > us...@domain.com <mailto:us...@domain.com> us...@domain3.com > > <mailto:us...@domain3.com> but it's not a good solution (especially for > > a 200 characters :) ). > > > > Is there anybody who can write me the script which will make a copy for > > all of the users's archive folder? > > > > use recipient_bcc_maps and/or sender_bcc_maps with pcre (to keep the > "original" address). >