From: Brian Gernhardt <brian@gernhardtsoftware.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/3] send-email: Add sendemail.smtpdomain
Date: Fri, 9 Apr 2010 01:11:46 -0400 [thread overview]
Message-ID: <1270789906-23735-4-git-send-email-brian@gernhardtsoftware.com> (raw)
In-Reply-To: <1270789906-23735-1-git-send-email-brian@gernhardtsoftware.com>
--smtp-domain is an option that if you need once, you probably will
need again. To help with that, allow the user to set it in their
.gitconfig
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
---
Seemed like a natural thing to add. Was surprised it wasn't there when I went
poking around.
Documentation/git-send-email.txt | 3 ++-
git-send-email.perl | 20 ++++++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f171471..288a4ec 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -123,7 +123,8 @@ Sending
Specifies the Fully Qualified Domain Name (FQDN) used in the
HELO/EHLO command to the SMTP server. Some servers require the
FQDN to match your IP address. If not set, git send-email attempts
- to determine your FQDN automatically.
+ to determine your FQDN automatically. Default is the value of
+ 'sendemail.smtpdomain'.
--smtp-pass[=<password>]::
Password for SMTP-AUTH. The argument is optional: If no
diff --git a/git-send-email.perl b/git-send-email.perl
index 85fe374..14b996e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -132,8 +132,7 @@ my $have_email_valid = eval { require Email::Valid; 1 };
my $have_mail_address = eval { require Mail::Address; 1 };
my $smtp;
my $auth;
-my $mail_domain_default = "localhost.localdomain";
-my $mail_domain;
+my $smtp_domain_default = "localhost.localdomain";
sub unique_email_list(@);
sub cleanup_compose_files();
@@ -190,7 +189,7 @@ sub do_edit {
# Variables with corresponding config settings
my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
-my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
+my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
my ($validate, $confirm);
my (@suppress_cc);
@@ -212,6 +211,7 @@ my %config_settings = (
"smtpserverport" => \$smtp_server_port,
"smtpuser" => \$smtp_authuser,
"smtppass" => \$smtp_authpass,
+ "smtpdomain" => \$smtp_domain,
"to" => \@to,
"cc" => \@initial_cc,
"cccmd" => \$cc_cmd,
@@ -283,7 +283,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"smtp-ssl" => sub { $smtp_encryption = 'ssl' },
"smtp-encryption=s" => \$smtp_encryption,
"smtp-debug:i" => \$debug_net_smtp,
- "smtp-domain:s" => \$mail_domain,
+ "smtp-domain:s" => \$smtp_domain,
"identity=s" => \$identity,
"annotate" => \$annotate,
"compose" => \$compose,
@@ -902,7 +902,7 @@ sub maildomain_mta
sub maildomain
{
- return maildomain_net() || maildomain_mta() || $mail_domain_default;
+ return maildomain_net() || maildomain_mta() || $smtp_domain_default;
}
# Returns 1 if the message was sent, and 0 otherwise.
@@ -1007,18 +1007,18 @@ X-Mailer: git-send-email $gitversion
if ($smtp_encryption eq 'ssl') {
$smtp_server_port ||= 465; # ssmtp
require Net::SMTP::SSL;
- $mail_domain ||= maildomain();
+ $smtp_domain ||= maildomain();
$smtp ||= Net::SMTP::SSL->new($smtp_server,
- Hello => $mail_domain,
+ Hello => $smtp_domain,
Port => $smtp_server_port);
}
else {
require Net::SMTP;
- $mail_domain ||= maildomain();
+ $smtp_domain ||= maildomain();
$smtp ||= Net::SMTP->new((defined $smtp_server_port)
? "$smtp_server:$smtp_server_port"
: $smtp_server,
- Hello => $mail_domain,
+ Hello => $smtp_domain,
Debug => $debug_net_smtp);
if ($smtp_encryption eq 'tls' && $smtp) {
require Net::SMTP::SSL;
@@ -1041,7 +1041,7 @@ X-Mailer: git-send-email $gitversion
die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
"VALUES: server=$smtp_server ",
"encryption=$smtp_encryption ",
- "maildomain=$mail_domain",
+ "maildomain=$smtp_domain",
defined $smtp_server_port ? "port=$smtp_server_port" : "";
}
--
1.7.1.rc0.210.ge6da
next prev parent reply other threads:[~2010-04-09 5:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 5:11 [PATCH 0/3] send-email: --smtp-domain improvements Brian Gernhardt
2010-04-09 5:11 ` [PATCH 1/3] send-email: Don't use FQDNs without a '.' Brian Gernhardt
2010-04-09 5:36 ` Junio C Hamano
2010-04-13 8:43 ` [PATCH] git-send-email.perl: Add sub maildomain_sanitize Jari Aalto
2010-04-13 11:35 ` [PATCH] git-send-email.perl: add maildomain_sanitize() Jari Aalto
2010-04-15 12:47 ` Jakub Narebski
2010-04-16 15:49 ` [PATCH v2] git-send-email.perl: Add sub maildomain_sanitize Jari Aalto
2010-04-16 16:11 ` Jakub Narebski
2010-04-16 17:00 ` Start encouraging English.pm (Was: [PATCH v2] git-send-email.perl: Add sub maildomain_sanitize) Jari Aalto
2010-04-09 5:11 ` [PATCH 2/3] Document send-email --smtp-domain Brian Gernhardt
2010-04-09 5:11 ` Brian Gernhardt [this message]
2010-04-09 6:56 ` [PATCH 3/3] send-email: Add sendemail.smtpdomain Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1270789906-23735-4-git-send-email-brian@gernhardtsoftware.com \
--to=brian@gernhardtsoftware.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.