View | Details | Raw Unified | Return to bug 214335 | Differences between
and this patch

Collapse All | Expand All

(-)git-send-email.perl (-23 / +10 lines)
Lines 27-32 Link Here
27
use File::Temp qw/ tempdir tempfile /;
27
use File::Temp qw/ tempdir tempfile /;
28
use File::Spec::Functions qw(catfile);
28
use File::Spec::Functions qw(catfile);
29
use Error qw(:try);
29
use Error qw(:try);
30
use Net::SMTP 2.34;
30
use Git;
31
use Git;
31
32
32
Getopt::Long::Configure qw/ pass_through /;
33
Getopt::Long::Configure qw/ pass_through /;
Lines 1337-1343 Link Here
1337
1338
1338
		if ($smtp_encryption eq 'ssl') {
1339
		if ($smtp_encryption eq 'ssl') {
1339
			$smtp_server_port ||= 465; # ssmtp
1340
			$smtp_server_port ||= 465; # ssmtp
1340
			require Net::SMTP::SSL;
1341
			$smtp_domain ||= maildomain();
1341
			$smtp_domain ||= maildomain();
1342
			require IO::Socket::SSL;
1342
			require IO::Socket::SSL;
1343
1343
Lines 1347-1381 Link Here
1347
				$IO::Socket::SSL::DEBUG = 1;
1347
				$IO::Socket::SSL::DEBUG = 1;
1348
			}
1348
			}
1349
1349
1350
			# Net::SMTP::SSL->new() does not forward any SSL options
1350
			$smtp = Net::SMTP->new($smtp_server,
1351
			IO::Socket::SSL::set_client_defaults(
1351
					       Hello => $smtp_domain,
1352
				ssl_verify_params());
1352
					       Port => $smtp_server_port,
1353
			$smtp ||= Net::SMTP::SSL->new($smtp_server,
1353
					       SSL => 1,
1354
						      Hello => $smtp_domain,
1354
					       ssl_verify_params(),
1355
						      Port => $smtp_server_port,
1355
					       Debug => $debug_net_smtp);
1356
						      Debug => $debug_net_smtp);
1357
		}
1356
		}
1358
		else {
1357
		else {
1359
			require Net::SMTP;
1360
			$smtp_domain ||= maildomain();
1361
			$smtp_server_port ||= 25;
1358
			$smtp_server_port ||= 25;
1362
			$smtp ||= Net::SMTP->new($smtp_server,
1359
			$smtp = Net::SMTP->new($smtp_server,
1363
						 Hello => $smtp_domain,
1360
						 Hello => $smtp_domain,
1364
						 Debug => $debug_net_smtp,
1361
						 Debug => $debug_net_smtp,
1365
						 Port => $smtp_server_port);
1362
						 Port => $smtp_server_port);
1366
			if ($smtp_encryption eq 'tls' && $smtp) {
1363
			if ($smtp_encryption eq 'tls' && $smtp) {
1367
				require Net::SMTP::SSL;
1364
				$smtp->starttls(ssl_verify_params());
1368
				$smtp->command('STARTTLS');
1365
				if ($smtp->code != 250) {
1369
				$smtp->response();
1370
				if ($smtp->code == 220) {
1371
					$smtp = Net::SMTP::SSL->start_SSL($smtp,
1372
									  ssl_verify_params())
1373
						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
1374
					$smtp_encryption = '';
1375
					# Send EHLO again to receive fresh
1376
					# supported commands
1377
					$smtp->hello($smtp_domain);
1378
				} else {
1379
					die "Server does not support STARTTLS! ".$smtp->message;
1366
					die "Server does not support STARTTLS! ".$smtp->message;
1380
				}
1367
				}
1381
			}
1368
			}

Return to bug 214335