[PATCH] Added get sendmail from .mailrc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Brilliantov Kirill Vladimirovich <brilliantov@xxxxxxxx>
---
 git-send-email.perl | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2016d9c..5345fdb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -28,6 +28,7 @@ use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catfile);
 use Error qw(:try);
 use Git;
+use File::HomeDir;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -804,6 +805,23 @@ if (!defined $smtp_server) {
 			last;
 		}
 	}
+
+	if (!defined $smtp_server) {
+		my $mailrc = File::HomeDir->my_home . "/.mailrc";
+		if (-e $mailrc) {
+			open FILE, $mailrc or die "Failed open $mailrc: $!";
+			while (<FILE>) {
+			    chomp;
+			    if (/set sendmail=.*/) {
+				my @data = split '"';
+				$smtp_server = $data[1];
+				last;
+			    }
+			}
+			close FILE;
+		}
+	}
+
 	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
 }
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]