[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[patch] commit-email.pl: help diagnose bad SMTP server address

From: Peter Samuelson <peter_at_p12n.org>
Date: 2007-11-08 03:06:55 CET

I just helped someone on #svn who got an obscure Perl error from
commit-email.pl because the default $smtp_server = '127.0.0.1' was not
correct. I suggest the following to reduce confusion in such cases.

-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/
[[[
* tools/hook-scripts/commit-email.pl.in:
  Exit with an error if we cannot connect to the SMTP server.
Patch by: Peter Samuelson <peter@p12n.org>
]]]
Index: tools/hook-scripts/commit-email.pl.in
===================================================================
--- tools/hook-scripts/commit-email.pl.in	(revisione 27691)
+++ tools/hook-scripts/commit-email.pl.in	(copia locale)
@@ -623,7 +623,8 @@
       }
     elsif (defined $smtp_server and @email_addresses)
       {
-        my $smtp = Net::SMTP->new($smtp_server);
+        my $smtp = Net::SMTP->new($smtp_server)
+          or die "$0: error opening SMTP session to `$smtp_server': $!\n";
         handle_smtp_error($smtp, $smtp->mail($mail_from));
         handle_smtp_error($smtp, $smtp->recipient(@email_addresses));
         handle_smtp_error($smtp, $smtp->data());
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 8 03:07:09 2007

This is an archived mail posted to the Subversion Dev mailing list.