send-email: only 'require' instead of 'use' Net::SMTP

This was proposed by Eric Wong and fixes the test. (Of course, git-send-email
does not work, if there is no Net::SMTP here, but it will say what is wrong
when you actually try to use send-email.)

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Schindelin 2006-06-01 00:55:47 +02:00 committed by Junio C Hamano
parent 6891281cfa
commit 87840620fd

View File

@ -21,7 +21,6 @@ use warnings;
use Term::ReadLine; use Term::ReadLine;
use Getopt::Long; use Getopt::Long;
use Data::Dumper; use Data::Dumper;
use Net::SMTP;
# most mail servers generate the Date: header, but not all... # most mail servers generate the Date: header, but not all...
$ENV{LC_ALL} = 'C'; $ENV{LC_ALL} = 'C';
@ -394,6 +393,7 @@ X-Mailer: git-send-email $gitversion
print $sm "$header\n$message"; print $sm "$header\n$message";
close $sm or die $?; close $sm or die $?;
} else { } else {
require Net::SMTP;
$smtp ||= Net::SMTP->new( $smtp_server ); $smtp ||= Net::SMTP->new( $smtp_server );
$smtp->mail( $from ) or die $smtp->message; $smtp->mail( $from ) or die $smtp->message;
$smtp->to( @recipients ) or die $smtp->message; $smtp->to( @recipients ) or die $smtp->message;