Author: Mauro Tortonesi <mauro@ferrara.linux.it>
Description: This patch changes the commit-email.pl script included in 
             subversion 1.2.1 to send email via SMTP instead of the legacy 
             sendmail interface.

--- commit-email.pl.in.orig	2005-07-17 00:31:53.753369272 -0500
+++ commit-email.pl.in	2005-07-17 00:39:02.540183768 -0500
@@ -36,6 +36,7 @@
 						
 use strict;
 use Carp;
+use Net::SMTP;
 
 ######################################################################
 # Configuration section.
@@ -63,27 +64,21 @@
 # Since the path to svnlook depends upon the local installation
 # preferences, check that the required programs exist to insure that
 # the administrator has set up the script properly.
-{
-  my $ok = 1;
-  foreach my $program ($sendmail, $svnlook)
-    {
-      if (-e $program)
-        {
-          unless (-x $program)
-            {
-              warn "$0: required program `$program' is not executable, ",
-                   "edit $0.\n";
-              $ok = 0;
-            }
-        }
-      else
-        {
-          warn "$0: required program `$program' does not exist, edit $0.\n";
-          $ok = 0;
-        }
-    }
-  exit 1 unless $ok;
-}
+
+if (-e $svnlook)
+  {
+    unless (-x $svnlook)
+      {
+        warn "$0: required program `$svnlook' is not executable, ",
+             "edit $0.\n";
+        exit 1;
+      }
+  }
+else
+  {
+    warn "$0: required program `$svnlook' does not exist, edit $0.\n";
+    exit 1;
+  }
 
 
 ######################################################################
@@ -106,12 +101,13 @@
 # This hash matches the command line option to the hash key in the
 # project.  If a key exists but has a false value (''), then the
 # command line option is allowed but requires special handling.
-my %opt_to_hash_key = ('--from' => 'from_address',
-                       '-h'     => 'hostname',
-                       '-l'     => 'log_file',
-                       '-m'     => '',
-                       '-r'     => 'reply_to',
-                       '-s'     => 'subject_prefix');
+my %opt_to_hash_key = ('--from'   => 'from_address',
+                       '-h'       => 'hostname',
+                       '-l'       => 'log_file',
+                       '-m'       => '',
+                       '-r'       => 'reply_to',
+		        '--server' => 'smtp_server',
+                       '-s'       => 'subject_prefix');
 
 while (@ARGV)
   {
@@ -460,21 +456,22 @@
 
     push(@head, "\n");
 
-    if ($sendmail =~ /\w/ and @email_addresses)
-      {
-        # Open a pipe to sendmail.
-        my $command = "$sendmail -f$mail_from $userlist";
-        if (open(SENDMAIL, "| $command"))
-          {
-            print SENDMAIL @head, @body;
-            close SENDMAIL
-              or warn "$0: error in closing `$command' for writing: $!\n";
-          }
-        else
-          {
-            warn "$0: cannot open `| $command' for writing: $!\n";
-          }
+    {
+      # Use Net::SMTP instead of sendmail
+      my $smtp;
+      
+      $smtp = Net::SMTP->new($project->{smtp_server});
+      $smtp->mail($mail_from);
+      $smtp->to(@email_addresses);
+
+      $smtp->data();
+      foreach (@head, @body) {
+        $smtp->datasend($_);
       }
+      $smtp->dataend();
+
+      $smtp->quit;
+    }
 
     # Dump the output to logfile (if its name is not empty).
     if ($log_file =~ /\w/)


