git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Added get sendmail from .mailrc

From
BVBrilliantov Kirill Vladimirovich <brilliantov@inbox.ru>
Date
Jan 25, 2014, 09:46 UTC
Message-ID
<1390643210-5748-1-git-send-email-brilliantov@inbox.ru>
Signed-off-by: Brilliantov Kirill Vladimirovich <brilliantov@inbox.ru>
---
 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
Next: Eric Wong
Message 1 of 8 in “Added get sendmail from .mailrc”
  1. Added get sendmail from .mailrcBrilliantov Kirill Vladimirovich, Jan 25, 2014
  2. Eric WongJan 25, 2014
  3. Brilliantov Kirill VladimirovichJan 26, 2014
  4. Brilliantov Kirill VladimirovichJan 26, 2014
  5. Eric WongJan 26, 2014
  6. Jeff KingJan 28, 2014
  7. Jeff KingJan 28, 2014
  8. Kyle J. McKayJan 28, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.