Re: [siesta-dev] linking with other systems; MySQL mail archive?

[prev] [thread] [next] [lurker] [Date index for 2004/10/14]

From: Bowen Dwelle
Subject: Re: [siesta-dev] linking with other systems; MySQL mail archive?
Date: 22:36 on 14 Oct 2004
Wow. It works.

nacho modify-plugin Archive info-list path 
'DBI:mysql:database=dwelle_org;host=mysql.dwelle.org;port=3306;user=USER;password=PASSWORD'

( in Siesta::Plugin::Archive )
use Email::FolderType::Register qw[register_type];
register_type Store => sub { $_[0] =~ m/^DBI/i };

( in Email::LocalDelivery::Store)
package Email::LocalDelivery::Store;
sub deliver {
     my ($class, $mail, @dsns) = @_;

     my @delivered;
     for my $dsn (@dsns) {
	# we should probably really only do this once ;]
	# there's probably a better way to call Email::Store
         eval "use Email::Store '$dsn'";
         my $stored = Email::Store::Mail->store($mail);
         push @delivered, $stored;
     }
     return @delivered;
}

No, really, wow. That's all it took. Holy shit.

mail is now going host aliases -> .procmailrc -> Siesta -> Archive -> 
Email::LocalDelivery::Store -> Email::Store -> mysql (and also back out 
via Send)

amazing.

PS. There's a little bug in Email::Store::List where it tries to use 
posting_address instead of post_address, but I fixed that.

Simon Wistow wrote:
> On Thu, Oct 14, 2004 at 09:55:15AM -0700, Bowen Dwelle said:
> 
>>Also, I see that Archive uses Email::LocalDelivery, which can store to 
>>MBox & Maildir -- how about a MySQL mail store (using Email::Store?) ?
> 
> 
> Shouldn't be too hard - Email::LocalDelivery use Email::FolderType which 
> has a pluggable mechanism for defining new delivery types.
> 
> So all you need to do is write a new one that understands that a path of 
> 
> 	store://<somestring>
> 
> indicates that you want to use Email::LocalDelivery::Store and which is 
> a thin shim round Email::Store et voila.
> 
> Simon
> 
There's stuff above here

Generated at 14:00 on 11 Nov 2004 by mariachi 0.52