[Exim] Archiving incoming and outgoing e-mail - SOLVED PARTL…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Odhiambo G. Washington
Date:  
À: exim-users
Sujet: [Exim] Archiving incoming and outgoing e-mail - SOLVED PARTLY!!
I am writing this for two reasons:

1. For the benefit of others who will be digging the archives of this
list for such a solution, and
2. For those who'd like to criti{cise|que} how I did it.

AIM:

My aim is to keep archives of outgoing and incoming mail for some users.
Hey, they want it, ok?

(a) outgoing mail archival

The first approach was to use a router and a transport. This sucks,
because it creates a new message per recipient, as someone kindly
pointed out to me, (hi Jon). If there is an outgoing email cc'd to
6 people and sent to 1, 7 messages are created in the archive (because
its handled as a transport which is run per address)

The right way to do it would be via a system filter, which would run
once per message.

So I created the address_directory2 as Philip pointed in the notes he
made in the configure.default, and I made that to use maildir format
as show below:

address_directory2:
 driver               = appendfile
 check_string         =
 message_prefix       = ""
 message_suffix       = ""
 delivery_date_add
 envelope_to_add
 return_path_add
 maildir_format


I modified my system filter transports to use this transport:

system_filter_directory_transport = address_directory2

I am using a file lookup to get the $sender_address for those users
who would like this archiving. So here is my filter for those who'd
like to comment on it:

if ${lookup{$sender_address}lsearch{/usr/local/etc/exim/mail_backup_users}{1}{0}} is 1 then
logfile /var/log/exim/mail_backup_users.log
logwrite "$tod_log Reason: (BACKUP_RULE was Matched)"
logwrite "$tod_log subject: $header_subject"
logwrite "$tod_log recipients: $recipients"
logwrite "$tod_log return path: $return_path"
logwrite "$tod_log sender_address_local_part: $sender_address_local_part"
logwrite "$tod_log sender_address_domain: $sender_address_domain"
logwrite "------------------------------------------------------------------------------"
unseen save /Mail-backup/${sender_address_domain}/${sender_address_local_part}/Maildir/.${substr_0_7:$tod_log}_outgoing// 0775
endif

The "//" is what makes the e-mails to be saved to maildir. I had to play
with the log options just to ensure that $sender_address_local_part and
$sender_address_domain were available for the system filter, because I
did not see them being mentioned in the filter spec (filter.txt), but
again I am not blaming Philip because I did all this in a hurry, reading
Exim book, spec.txt in addition.

I know for sure that this rule has a problem: Suppose someone spoofed
the $sender_address, then that mail will be saved as well. I'm still
pulling out my hair trying to figure out some logic to cater for that.
If someone has ideas, I'll be happy to know what it is ;)


(b) incoming mail archival

Now off to look at a better way for archiving incoming mail, other than
using shadow_transport.


        cheers
       - wash
+----------------------------------+-----------------------------------------+
Odhiambo Washington                     . WANANCHI ONLINE LTD (Nairobi, KE)  |
<wash at wananchi dot com>              . 1ere Etage, Loita Hse, Loita St.,  |
GSM: (+254) 722 743 223                 . # 10286, 00100 NAIROBI             |
GSM: (+254) 733 744 121                 . (+254) 020 313 985 - 9             |
+---------------------------------+------------------------------------------+
"Oh My God! They killed init! You Bastards!"
                         --from a /. post