Skip to contentSkip to conversation

How can I specify the "sendmail" program for git-send-email?

DISCUSSION Richard Yang 4 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi, experts

I read the git-send-email manual and find the --smtp-server option can specify the sendmail-like program to send mail.

Then I use this option in command line
--smtp-server=/usr/bin/msmtp
This works.

While I found it not very convenient to write the option on command line every time, then I wrote it in the .gitconfig file in my home directory.

[sendmail]
smtpserver = /usr/bin/msmtp
smtppass = 123456
smtpuser = [email protected]
smtpserverport = 143

While this time I don't use the --smtp-server option in command line.

And seems this time, it doesn't use the msmpt to send mail, since this time it fails.

Then my second approach is not correct?

Signature · 2 lines
Richard Yang
Help you, Help me
#1 lore raw
Quoted 9 lines · Richard Yang

Hi, experts

I read the git-send-email manual and find the --smtp-server option can specify the sendmail-like program to send mail.

Then I use this option in command line
--smtp-server=/usr/bin/msmtp
This works.

Quoted 8 lines

While I found it not very convenient to write the option on command line every time, then I wrote it in the .gitconfig file in my home directory.

[sendmail]
       smtpserver = /usr/bin/msmtp smtppass       = 123456
       smtpuser       = [email protected] smtpserverport = 143

The configuration-section for git send-mail is actually spelled "sendemail", and not "sendmail". Notice the additional 'e'.

http://git-scm.com/docs/git-send-email

#2 lore raw
Quoted 14 lines · Erik Faye-Lund
Quoted 12 lines · Richard Yang

Hi, experts

I read the git-send-email manual and find the --smtp-server option can specify the sendmail-like program to send mail.

Then I use this option in command line
--smtp-server=/usr/bin/msmtp
This works.

While I found it not very convenient to write the option on command line every time, then I wrote it in the .gitconfig file in my home directory.

Quoted 8 lines
Quoted 5 lines

[sendmail]
       smtpserver = /usr/bin/msmtp smtppass       = 123456
       smtpuser       = [email protected] smtpserverport = 143

The configuration-section for git send-mail is actually spelled "sendemail", and not "sendmail". Notice the additional 'e'.

Oops, a stupid mistake.

Thanks all :)

Quoted 2 lines

http://git-scm.com/docs/git-send-email

Signature · 2 lines
Richard Yang
Help you, Help me
#3 lore raw
Quoted 21 lines · Richard Yang
Quoted 20 lines · Erik Faye-Lund
Quoted 17 lines · Richard Yang

Hi, experts

I read the git-send-email manual and find the --smtp-server option can specify the sendmail-like program to send mail.

Then I use this option in command line
--smtp-server=/usr/bin/msmtp
This works.

While I found it not very convenient to write the option on command line every time, then I wrote it in the .gitconfig file in my home directory.

[sendmail]
       smtpserver = /usr/bin/msmtp smtppass       = 123456
       smtpuser       = [email protected] smtpserverport = 143

Quoted 5 lines
Quoted 2 lines

The configuration-section for git send-mail is actually spelled "sendemail", and not "sendmail". Notice the additional 'e'.

Oops, a stupid mistake.

Thanks all :)

Well, I've always been slightly annoyed by the "send-mail" vs "sendemail" inconsistency. Perhaps we could do something along these lines (plus all documentation-updates, omitted for clarity) to reduce the risk of confusion?

Yeah, the leaking of $identity between different sections is a bit suboptimal, but as a fallback-mechanism I don't think it actually matters much.

git-send-email.perl +5 -1
index 03292fd..d167d96 100755
@@ -375,7 +375,11 @@ sub read_config {
 	}
 }
 
-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail]
+$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"
 $identity = Git::config(@repo, "sendemail.identity") unless (defined

$identity);
read_config("sendemail.$identity") if (defined $identity); read_config("sendemail");

#4 lore raw

Erik Faye-Lund <[email protected]> a écrit :

Quoted 8 lines

Well, I've always been slightly annoyed by the "send-mail" vs "sendemail" inconsistency. Perhaps we could do something along these lines (plus all documentation-updates, omitted for clarity) to reduce the risk of confusion?

Yeah, the leaking of $identity between different sections is a bit suboptimal, but as a fallback-mechanism I don't think it actually matters much.

[...]

Quoted 11 lines
git-send-email.perl +2 -1
-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail]
+$identity = Git::config(@repo, "sendmail.identity") unless (defined  

$identity);

git-send-email.perl +3 -0
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"
 $identity = Git::config(@repo, "sendemail.identity") unless (defined

$identity);
read_config("sendemail.$identity") if (defined $identity); read_config("sendemail");

I'm not very familiar with perl, but do you mean to replace "sendemail" by "sendmail" or just make "sendmail" usable in the config file, along with "sendemail" ?

#5 lore raw
Quoted 26 lines · On Mon, Jun 11, 2012 at 11:25 AM, <[email protected]> wrote:

Erik Faye-Lund <[email protected]> a écrit :

Quoted 8 lines

Well, I've always been slightly annoyed by the "send-mail" vs "sendemail" inconsistency. Perhaps we could do something along these lines (plus all documentation-updates, omitted for clarity) to reduce the risk of confusion?

Yeah, the leaking of $identity between different sections is a bit suboptimal, but as a fallback-mechanism I don't think it actually matters much.

[...]

Quoted 9 lines

-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail] +$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);

git-send-email.perl +3 -0
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"

 $identity = Git::config(@repo, "sendemail.identity") unless (defined

Quoted 8 lines
Quoted 3 lines

$identity);
 read_config("sendemail.$identity") if (defined $identity); read_config("sendemail");

I'm not very familiar with perl, but do you mean to replace "sendemail" by "sendmail" or just make "sendmail" usable in the config file, along with "sendemail" ?

I meant to switch to "sendmail", but keep "sendemail" around to be backwards compatible. At some point in the future it might make sense to remove the support for "sendemail", though.

#6 lore raw

Erik Faye-Lund <[email protected]> a écrit :

Quoted 2 lines

I meant to switch to "sendmail", but keep "sendemail" around to be backwards compatible.

Sounds good to me. That would avoid everyone to change their config file and, for those who haven't set [sendemail], it would be more natural to type "sendmail" than "sendemail" (that's my personal opinion though).

#7 lore raw
In reply to Erik Faye-Lund
Quoted 2 lines · Erik Faye-Lund

Well, I've always been slightly annoyed by the "send-mail" vs "sendemail" inconsistency.

Hrm, isn't it between "sendmail" (as in /usr/lib/sendmail) and "send-email" (a subcommand of git)?

Quoted 3 lines

Perhaps we could do something along these
lines (plus all documentation-updates, omitted for clarity) to reduce the risk of confusion?

Assuming that the contrast between "sendmail" and "git send-email" is what you are trying to address, I fail to see how it would help reducing the confusion if you start naming configuration variables used by "git send-email" without E.

If the proposal were to give "send-email.$var" synomyms to corresponding "sendemail.$var" variables, I would have been persuaded to believe it may alleviate potential confusion, though.

Quoted 22 lines

Yeah, the leaking of $identity between different sections is a bit suboptimal, but as a fallback-mechanism I don't think it actually matters much.

git-send-email.perl +5 -1
index 03292fd..d167d96 100755
@@ -375,7 +375,11 @@ sub read_config {
 	}
 }
 
-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail]
+$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"
 $identity = Git::config(@repo, "sendemail.identity") unless (defined
 $identity);
 read_config("sendemail.$identity") if (defined $identity);

read_config("sendemail");

#8 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Erik Faye-Lund

Well, I've always been slightly annoyed by the "send-mail" vs "sendemail" inconsistency.

Hrm, isn't it between "sendmail" (as in /usr/lib/sendmail) and "send-email" (a subcommand of git)?

Ugh, you are right. My brain must have been defective :)

Quoted 9 lines
Quoted 3 lines

Perhaps we could do something along these
lines (plus all documentation-updates, omitted for clarity) to reduce the risk of confusion?

Assuming that the contrast between "sendmail" and "git send-email" is what you are trying to address, I fail to see how it would help reducing the confusion if you start naming configuration variables used by "git send-email" without E.

No, this was just me being a moron.

Quoted 3 lines

If the proposal were to give "send-email.$var" synomyms to corresponding "sendemail.$var" variables, I would have been persuaded to believe it may alleviate potential confusion, though.

This was really the way I wanted to go, but I somehow got unsure about the legality of the dashes in config sections. I'm a bit skeptical to introducing new non-letter characters if we don't have to.

So let's just drop my suggestion. I wasn't thinking straight.