[Mimedefang] sql integration of quarentine and others

Jeff Rife mimedefang at nabs.net
Wed Apr 4 00:03:07 EDT 2007


On 3 Apr 2007 at 14:41, Danny Kjærgaard wrote:

> I'm trying to make an sql integration with mimedefang. I would like to store 
> alle spam and virus mails i mysql, but what would be the best way to do this 
> ? and where i the filter, begin, end or some other place?

If you want to store the contents of the e-mail in a mysql table, then 
it's pretty easy.  Note there is no error checking in the quick code 
below:

#################################################
open(IN, "<./INPUTMSG");
my $msg = join("\n", <IN>);
close(IN);

$dbh->do(qq{
INSERT INTO mail (ip_address, mail_message)
VALUES ($RelayAddr, $msg)
});
#################################################

Basically, after you have decided that you want to store the message 
for whatever reason, just use code like the above in any of 
filter_begin, filter, filter_multipart, or filter_end.  "$dbh" is a 
handle to your database connection returned by DBI->connect.

Obviously, you'd need to change the table and column names to match 
your setup, and what you want to store.


--
Jeff Rife | "Five thousand dollars, huh?  I'll bet we could 
          |  afford that if we pooled our money together... 
          |  bought a gun...robbed a bank...." 
          |         -- Drew Carey 





More information about the MIMEDefang mailing list