Index: modules/og2list/mail-in.pl =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og2list/mail-in.pl,v retrieving revision 1.33 diff -u -r1.33 mail-in.pl --- modules/og2list/mail-in.pl 5 Dec 2006 23:57:03 -0000 1.33 +++ modules/og2list/mail-in.pl 25 Apr 2007 19:17:51 -0000 @@ -246,6 +246,8 @@ $add_attachment_stmt $add_attachment_handle + %sites $site + $dbtype $dbuser $dbauth $dbhost $dbase $mail_domain $sendmail_binary @sendmail_args @@ -341,6 +343,17 @@ ($address[0]->name, $address[0]->address); }; +# Extract database information using to_address +$site = $to_address; +$site =~ /@.*\.(.*)\.com.*/; +$site = $1; +$mail_domain = $sites{$site}{'mail_domain'}; +$dbtype = $sites{$site}{'dbtype'}; +$dbase = $sites{$site}{'dbase'}; +$dbhost = $sites{$site}{'dbhost'}; +$dbuser = $sites{$site}{'dbuser'}; +$dbauth = $sites{$site}{'dbauth'}; + # Decode subject according to RfC1522/2045, using MIME::Words foreach (decode_mimewords($head->get("Subject",0))) { $subject.=($$_[1]?decode($$_[1], $$_[0]) : $$_[0]); Index: modules/og2list/mail-out.pl =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og2list/mail-out.pl,v retrieving revision 1.37 diff -u -r1.37 mail-out.pl --- modules/og2list/mail-out.pl 3 Nov 2006 08:39:15 -0000 1.37 +++ modules/og2list/mail-out.pl 25 Apr 2007 19:20:40 -0000 @@ -78,6 +78,8 @@ $get_digest_rcpt_handle $clear_digest_rcpt_handle + %sites $site $key $val + $dbtype $dbuser $dbauth $dbhost $dbase $mail_domain $set_reply_to @@ -266,6 +268,18 @@ getopts('d', \%opts); $do_digest = $opts{'d'}; +# Loop through the hash sites +while (($key, $val) = each %sites) { + +# Fill in database connections from site of sites hash +$site = $key; +$mail_domain = $sites{$site}{'mail_domain'}; +$dbtype = $sites{$site}{'dbtype'}; +$dbase = $sites{$site}{'dbase'}; +$dbhost = $sites{$site}{'dbhost'}; +$dbuser = $sites{$site}{'dbuser'}; +$dbauth = $sites{$site}{'dbauth'}; + # Make database connection $dsn = "DBI:$dbtype:$dbase:$dbhost"; $dbh = DBI->connect($dsn, $dbuser, $dbauth) or die; @@ -429,6 +443,8 @@ $get_del_arg_handle->execute($mid); } +} # end of while loop for each site + # Local Variables: # mode:cperl Index: modules/og2list/mail.conf =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og2list/mail.conf,v retrieving revision 1.8 diff -u -r1.8 mail.conf --- modules/og2list/mail.conf 4 Sep 2006 14:20:24 -0000 1.8 +++ modules/og2list/mail.conf 25 Apr 2007 19:23:32 -0000 @@ -1,20 +1,49 @@ # -*- cperl -*- # $Id: mail.conf,v 1.8 2006/09/04 14:20:24 bengen Exp $ -# The domain that is appended to the ogroup-specific localparts. -$mail_domain = "example.invalid"; - -# Connection parameters to the Drupal database -# type of database connection -$dbtype = "mysql"; -# name of your database server -$dbase = ""; -# name of your Drupal database -$dbhost = "localhost"; -# name of your database user -$dbuser = ""; -# the user's password for your database server -$dbauth = ""; +# og2list site settings +# Note: include as many sites as you want by creating a hash +# for them. Each site hash must be specified in the %sites hash. + +# hash of first site to use with og2list +my %examplesite1 = ( + # The domain that is appended to the ogroup-specific localparts. + 'mail_domain' => 'lists.examplesite1.com', + # Connection parameters to the Drupal database + # type of database connection + 'dbtype' => 'mysql', + # name of your database server + 'dbase' => 'examplesite1db', + # name of your Drupal database + 'dbhost' => 'localhost', + # name of your database user + 'dbuser' => 'drupaluser', + # the user's password for your database server + 'dbauth' => 'pass', +); + +# hash of another site +my %examplesite2 = ( + 'mail_domain' => 'lists.examplesite2.com', + 'dbtype' => 'mysql', + 'dbase' => 'examplesite2db', + 'dbhost' => 'localhost', + 'dbuser' => 'drupaluser', + 'dbauth' => 'pass', +); + +# hash storing each site +# Note: To have a site be included with og2list it must be +# listed in this hash. The key must match the domain name +# of your mail domain and the value must be a hash you +# created above. +%sites = ( + # key => value + # Note: since value is a hash you must dereference it + # by using a backslash (\) + 'examplesite1' => \%examplesite1, + 'examplesite2' => \%examplesite2, +); # Reply-To header to the list for outgoing messages $set_reply_to = 0;