[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Archiving mails with smail



dg@bingo.baynet.de writes:

> Hi all!
> 
> I am currently building an intranet server for the company where I'm
> working. I use smail (from bo) and the users are going to work with
> different mail clients (Netscape or Outlook Express) over POP3 (qpopper).
> The server will have an dialout connection to our ISP (ppp) and a multidrop
> mailbox feed (fetchmail-POP3).
> 
> So now I want to build an automated archive of every mail that is sent or
> received over our mail server. This archive should be a textfile which is
> accesable as a mail folder from within PINE or something else. I want to
> build ONE archive file per day and this file should be burned on a CD (once
> in a month or so). 
> 
> Has anyone a solution, eventually where a copy of every mail is routed to a
> specific user ???

This ought to work; I use something very similar:
To every transport listed in /etc/smail/transports, add
"shadow=keepit".  That is, one of the transports might look like:

local:  driver=appendfile, from, local, inet, return_path,
	unix_from_hack, shadow=keepit;
        append_as_user, check_user, file=/var/spool/mail/${lc:strip:user},
        group=mail, mode=0660, notify_comsat, suffix="\n"

Then, add this to the end:
keepit:	driver=pipe, from, local, inet, return_path, unix_from_hack;
        cmd="/usr/local/bin/keepitmail 0", umask=0077, user=root,
	group=mail, parent_env, -ignore_status

Now, make /usr/local/bin/keepitmail the following script:
#!/bin/sh
LOGDIR="/var/log/mailstorage";
MAILLOGPREFIX="mailstorage";
STOREFILE="$MAILLOGPREFIX.`date +%Y%m%d`";
cat >> $LOGDIR/$STOREFILE
echo >> $LOGDIR/$STOREFILE
exit $1;

Note that this only logs mail that is successfully passed on to the
outside world or delivered locally.  You could add "error=errorkeepitmail"
to each transport and then add:
errorkeepit:	driver=pipe, from, local, inet, return_path, unix_from_hack;
        cmd="/usr/local/bin/keepitmail 1", umask=0077, user=root,
	group=mail, parent_env, -ignore_status

To the end to log mail with errors as well.  However, this might make
mail bounced for errors not have the correct error message.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: