[Mimedefang] Re: sql integration of quarentine and others

Danny Kjærgaard danny at resennet.dk
Wed Apr 4 03:21:31 EDT 2007


Hi,

And there would be no need for qouteing the msg or outcomment nasty 
chars that would break the perl code ?

Cheers
Danny


"Jeff Rife" <mimedefang at nabs.net> skrev i en meddelelse news:<4612EB3B.25323.A24C57 at mimedefang.nabs.net>...
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 


----------

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.25/745 - Release Date: 03-04-2007 12:48
 



More information about the MIMEDefang mailing list