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 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)/ )
{
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"
}

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)/ )
{
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 us...@domain.com 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?

Thank you very much!
Best regards,
Gabor

Reply via email to