threads / patch / 4140

patchsend-email: allow sendmail binary to be used instead of SMTP

Subject: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

## tl;dr

17 messages between May 15, 2006 and May 15, 2006. Diffs are folded; open one to read it.

replies: 16people: 4as markdown or json

Eric Wong· May 15, 2006, 02:32 UTC · lore

This should make local mailing possible for machines without a connection to an SMTP server.

It'll default to using /usr/sbin/sendmail or /usr/lib/sendmail if no SMTP server is specified (the default). If it can't find either of those paths, it'll fall back to connecting to an SMTP server on localhost.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-send-email.perl |   55 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 42 insertions(+), 13 deletions(-)
1c9bacc5a2bfe382f68046aeba62302d28e4c976
Show changes to git-send-email.perl +42 −13
diff --git a/git-send-email.perl b/git-send-email.perl
index d8c4b1f..d27a7a5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -40,7 +40,8 @@ # Variables we fill in automatically, or
 my (@to,@cc,@initial_cc,$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
 
 # Behavior modification variables
-my ($chain_reply_to, $smtp_server, $quiet, $suppress_from, $no_signed_off_cc) = (1, "localhost", 0, 0, 0);
+my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc) = (1, 0, 0, 0);
+my $smtp_server;
 
 # Example reply to:
 #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -179,8 +180,14 @@ if (!defined $initial_reply_to && $promp
 	$initial_reply_to =~ s/(^\s+|\s+$)//g;
 }
 
-if (!defined $smtp_server) {
-	$smtp_server = "localhost";
+if (!$smtp_server) {
+	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
+		if (-x $_) {
+			$smtp_server = $_;
+			last;
+		}
+	}
+	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
 }
 
 if ($compose) {
@@ -358,18 +365,39 @@ X-Mailer: git-send-email $gitversion
 ";
 	$header .= "In-Reply-To: $reply_to\n" if $reply_to;
 
-	$smtp ||= Net::SMTP->new( $smtp_server );
-	$smtp->mail( $from ) or die $smtp->message;
-	$smtp->to( @recipients ) or die $smtp->message;
-	$smtp->data or die $smtp->message;
-	$smtp->datasend("$header\n$message") or die $smtp->message;
-	$smtp->dataend() or die $smtp->message;
-	$smtp->ok or die "Failed to send $subject\n".$smtp->message;
+	if ($smtp_server =~ m#^/#) {
+		my $pid = open my $sm, '|-';
+		defined $pid or die $!;
+		if (!$pid) {
+			exec($smtp_server,'-i',@recipients) or die $!;
+		}
+		print $sm "$header\n$message";
+		close $sm or die $?;
+		if ($quiet) {
+			printf "Sent %s\n", $subject;
+		} else {
+			print "OK. Log says:
+Date: $date
+Sendmail: $smtp_server
+From: $from
+Subject: $subject
+Cc: $cc
+To: $to
 
-	if ($quiet) {
-		printf "Sent %s\n", $subject;
+Result: OK\n";
+		}
 	} else {
-		print "OK. Log says:
+		$smtp ||= Net::SMTP->new( $smtp_server );
+		$smtp->mail( $from ) or die $smtp->message;
+		$smtp->to( @recipients ) or die $smtp->message;
+		$smtp->data or die $smtp->message;
+		$smtp->datasend("$header\n$message") or die $smtp->message;
+		$smtp->dataend() or die $smtp->message;
+		$smtp->ok or die "Failed to send $subject\n".$smtp->message;
+		if ($quiet) {
+			printf "Sent %s\n", $subject;
+		} else {
+			print "OK. Log says:
 Date: $date
 Server: $smtp_server Port: 25
 From: $from
@@ -378,6 +406,7 @@ Cc: $cc
 To: $to
 
 Result: ", $smtp->code, ' ', ($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
+		}
 	}
 }
 
-- 
1.3.2.g1c9b
Eric Wong· May 15, 2006, 02:34 UTC · re: Eric Wong · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Eric Wong <normalperson@yhbt.net> wrote:
Show 9 quoted lines
> This should make local mailing possible for machines without
> a connection to an SMTP server.
> 
> It'll default to using /usr/sbin/sendmail or /usr/lib/sendmail
> if no SMTP server is specified (the default).  If it can't find
> either of those paths, it'll fall back to connecting to an SMTP
> server on localhost.
> 
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Also, Thanks to Martin Langhoff for bringing this up.
-- 
Eric Wong
Eric Wong· May 15, 2006, 02:38 UTC · re: Eric Wong · lore

[PATCH] send-email: quiet some warnings

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-send-email.perl |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
0e5a33f56f62e527b74b2afbd93a1cca812f97af
Show changes to git-send-email.perl +10 −2
diff --git a/git-send-email.perl b/git-send-email.perl
index d27a7a5..379e0c4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -507,8 +507,16 @@ sub unique_email_list(@) {
 	my @emails;
 
 	foreach my $entry (@_) {
-		my $clean = extract_valid_address($entry);
-		next if $seen{$clean}++;
+		if (my $clean = extract_valid_address($entry)) {
+			$seen{$clean} ||= 0;
+			next if $seen{$clean}++;
+		} else {
+			# it could still be a local email address without '@',
+			# which neither Email::Valid or our own small regex says
+			# is valid...
+			$seen{$entry} ||= 0;
+			next if $seen{$entry}++;
+		}
 		push @emails, $entry;
 	}
 	return @emails;
-- 
1.3.2.g0e5a
Junio C Hamano· May 15, 2006, 06:04 UTC · re: Eric Wong · lore

Re: [PATCH] send-email: quiet some warnings

Eric Wong <normalperson@yhbt.net> writes:
Show 16 quoted lines
> @@ -507,8 +507,16 @@ sub unique_email_list(@) {
>  	my @emails;
>  
>  	foreach my $entry (@_) {
> -		my $clean = extract_valid_address($entry);
> -		next if $seen{$clean}++;
> +		if (my $clean = extract_valid_address($entry)) {
> +			$seen{$clean} ||= 0;
> +			next if $seen{$clean}++;
> +		} else {
> +			# it could still be a local email address without '@',
> +			# which neither Email::Valid or our own small regex says
> +			# is valid...
> +			$seen{$entry} ||= 0;
> +			next if $seen{$entry}++;
> +		}

Wouldn't you want three kinds of return values from sub extract_valid_address() if you want to do this? That is,

 (1) address is valid and this is the cleaned up value;
 (2) address is known to be bogus; do not use it.
 (3) address might be local.

And (1) and (3) are probably the same thing in practice. In a localsite setting, it is often convenient to be able to use addr-spec that is local-part only, so something like the attached change, with your error squelching for 'undef' return in the second case, might be more appropriate.

-- >8 --
Show changes to git-send-email.perl +3 −0
diff --git a/git-send-email.perl b/git-send-email.perl
index d8c4b1f..7a89e26 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -300,6 +300,9 @@ our ($message_id, $cc, %mail, $subject, 
 
 sub extract_valid_address {
 	my $address = shift;
+
+	return $address if ($address =~ /^(\w+)$/);
+
 	if ($have_email_valid) {
 		return Email::Valid->address($address);
 	} else {
Eric Wong· May 15, 2006, 09:41 UTC · re: Junio C Hamano · lore

[PATCH] send-email: quiet some warnings, reject invalid addresses

I'm not sure why we never actually rejected invalid addresses in the first place. We just seemed to be using our email validity checkers to kill duplicates.

Now we just drop invalid email addresses completely and warn the user about it.

Since we support local sendmail, we'll also accept username-only addresses.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-send-email.perl |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
f069e9a9cee726d82dfeee1d477152a0fe0651c1
Show changes to git-send-email.perl +12 −3
diff --git a/git-send-email.perl b/git-send-email.perl
index 0540e93..312a4ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -307,6 +307,10 @@ our ($message_id, $cc, %mail, $subject, 
 
 sub extract_valid_address {
 	my $address = shift;
+
+	# check for a local address:
+	return $address if ($address =~ /^([\w\-]+)$/);
+
 	if ($have_email_valid) {
 		return Email::Valid->address($address);
 	} else {
@@ -498,9 +502,14 @@ sub unique_email_list(@) {
 	my @emails;
 
 	foreach my $entry (@_) {
-		my $clean = extract_valid_address($entry);
-		next if $seen{$clean}++;
-		push @emails, $entry;
+		if (my $clean = extract_valid_address($entry)) {
+			$seen{$clean} ||= 0;
+			next if $seen{$clean}++;
+			push @emails, $entry;
+		} else {
+			print STDERR "W: unable to extract a valid address",
+					" from: $entry\n";
+		}
 	}
 	return @emails;
 }
-- 
1.3.2.g7d11
Junio C Hamano· May 15, 2006, 05:52 UTC · re: Eric Wong · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Eric Wong <normalperson@yhbt.net> writes:
> This should make local mailing possible for machines without
> a connection to an SMTP server.
Which is a good thing, but
> It'll default to using /usr/sbin/sendmail or /usr/lib/sendmail
> if no SMTP server is specified (the default).  If it can't find
> either of those paths, it'll fall back to connecting to an SMTP
> server on localhost.

I do not know if it is OK to change the default to first prefer local MDA executable and then "localhost". That is, ...

Show 17 quoted lines
> @@ -179,8 +180,14 @@ if (!defined $initial_reply_to && $promp
>  	$initial_reply_to =~ s/(^\s+|\s+$)//g;
>  }
>  
> -if (!defined $smtp_server) {
> -	$smtp_server = "localhost";
> +if (!$smtp_server) {
> +	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
> +		if (-x $_) {
> +			$smtp_server = $_;
> +			last;
> +		}
> +	}
> +	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
>  }
>  
>  if ($compose) {

Without this hunk, people who did not specify --smtp-server=host could get away with having anything that listens to 25/tcp on the localhost that is not either of the above two paths; now they have to explicitly say --smtp-server=localhost to defeat what this hunk does. I do not know if it is a big deal, though.

> +	if ($smtp_server =~ m#^/#) {

I like this if(){}else{} here, but have a feeling that the logging part should be placed outside it to be shared.

While we are at it, we might want to enhance $smtp_server parsing to take host:port notation so that people can use message submission port 587/tcp (RFC 4409) instead.

Eric Wong· May 15, 2006, 09:27 UTC · re: Junio C Hamano · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Junio C Hamano <junkio@cox.net> wrote:
Show 38 quoted lines
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > This should make local mailing possible for machines without
> > a connection to an SMTP server.
> 
> Which is a good thing, but
> 
> > It'll default to using /usr/sbin/sendmail or /usr/lib/sendmail
> > if no SMTP server is specified (the default).  If it can't find
> > either of those paths, it'll fall back to connecting to an SMTP
> > server on localhost.
> 
> I do not know if it is OK to change the default to first prefer
> local MDA executable and then "localhost".  That is, ...
> 
> > @@ -179,8 +180,14 @@ if (!defined $initial_reply_to && $promp
> >  	$initial_reply_to =~ s/(^\s+|\s+$)//g;
> >  }
> >  
> > -if (!defined $smtp_server) {
> > -	$smtp_server = "localhost";
> > +if (!$smtp_server) {
> > +	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
> > +		if (-x $_) {
> > +			$smtp_server = $_;
> > +			last;
> > +		}
> > +	}
> > +	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
> >  }
> >  
> >  if ($compose) {
> 
> Without this hunk, people who did not specify --smtp-server=host
> could get away with having anything that listens to 25/tcp on
> the localhost that is not either of the above two paths; now
> they have to explicitly say --smtp-server=localhost to defeat
> what this hunk does.  I do not know if it is a big deal, though.

I believe this is what Martin wanted. I think it's a good idea since sendmail binaries tend to be more flexible, but I'm ok with it either way.

Of course, Greg and Ryan were the original authors of this, so I'd like their take on it, too.

> > +	if ($smtp_server =~ m#^/#) {
> 
> I like this if(){}else{} here, but have a feeling that the
> logging part should be placed outside it to be shared.

Cleaned that up a bit, patch coming. Also removed the Port: printout completely, as it's rather redundant (see below).

> While we are at it, we might want to enhance $smtp_server parsing
> to take host:port notation so that people can use message
> submission port 587/tcp (RFC 4409) instead.

This already works, IO::Socket::INET (behind Net::SMTP) takes care of it :)

-- 
Eric Wong
Eric Wong· May 15, 2006, 09:34 UTC · re: Eric Wong · lore

This should make local mailing possible for machines without a connection to an SMTP server.

It'll default to using /usr/sbin/sendmail or /usr/lib/sendmail if no SMTP server is specified (the default). If it can't find either of those paths, it'll fall back to connecting to an SMTP server on localhost.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-send-email.perl |   60 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 40 insertions(+), 20 deletions(-)
d4248a8ab7c883ab0f4dc080374bf60dc582f0f4
Show changes to git-send-email.perl +40 −20
diff --git a/git-send-email.perl b/git-send-email.perl
index d8c4b1f..0540e93 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -40,7 +40,8 @@ # Variables we fill in automatically, or
 my (@to,@cc,@initial_cc,$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
 
 # Behavior modification variables
-my ($chain_reply_to, $smtp_server, $quiet, $suppress_from, $no_signed_off_cc) = (1, "localhost", 0, 0, 0);
+my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc) = (1, 0, 0, 0);
+my $smtp_server;
 
 # Example reply to:
 #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -179,8 +180,14 @@ if (!defined $initial_reply_to && $promp
 	$initial_reply_to =~ s/(^\s+|\s+$)//g;
 }
 
-if (!defined $smtp_server) {
-	$smtp_server = "localhost";
+if (!$smtp_server) {
+	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
+		if (-x $_) {
+			$smtp_server = $_;
+			last;
+		}
+	}
+	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
 }
 
 if ($compose) {
@@ -358,26 +365,39 @@ X-Mailer: git-send-email $gitversion
 ";
 	$header .= "In-Reply-To: $reply_to\n" if $reply_to;
 
-	$smtp ||= Net::SMTP->new( $smtp_server );
-	$smtp->mail( $from ) or die $smtp->message;
-	$smtp->to( @recipients ) or die $smtp->message;
-	$smtp->data or die $smtp->message;
-	$smtp->datasend("$header\n$message") or die $smtp->message;
-	$smtp->dataend() or die $smtp->message;
-	$smtp->ok or die "Failed to send $subject\n".$smtp->message;
-
+	if ($smtp_server =~ m#^/#) {
+		my $pid = open my $sm, '|-';
+		defined $pid or die $!;
+		if (!$pid) {
+			exec($smtp_server,'-i',@recipients) or die $!;
+		}
+		print $sm "$header\n$message";
+		close $sm or die $?;
+	} else {
+		$smtp ||= Net::SMTP->new( $smtp_server );
+		$smtp->mail( $from ) or die $smtp->message;
+		$smtp->to( @recipients ) or die $smtp->message;
+		$smtp->data or die $smtp->message;
+		$smtp->datasend("$header\n$message") or die $smtp->message;
+		$smtp->dataend() or die $smtp->message;
+		$smtp->ok or die "Failed to send $subject\n".$smtp->message;
+	}
 	if ($quiet) {
 		printf "Sent %s\n", $subject;
 	} else {
-		print "OK. Log says:
-Date: $date
-Server: $smtp_server Port: 25
-From: $from
-Subject: $subject
-Cc: $cc
-To: $to
-
-Result: ", $smtp->code, ' ', ($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
+		print "OK. Log says:\nDate: $date\n";
+		if ($smtp) {
+			print "Server: $smtp_server\n";
+		} else {
+			print "Sendmail: $smtp_server\n";
+		}
+		print "From: $from\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
+		if ($smtp) {
+			print "Result: ", $smtp->code, ' ',
+				($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
+		} else {
+			print "Result: OK\n";
+		}
 	}
 }
 
-- 
1.3.2.g7d11
Junio C Hamano· May 15, 2006, 09:47 UTC · re: Eric Wong · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Eric Wong <normalperson@yhbt.net> writes:
> I believe this is what Martin wanted.  I think it's a good idea since
> sendmail binaries tend to be more flexible, but I'm ok with it either
> way.

I am not opposed to have an option to run a local submission agent binary (I said I like that if(){}else{} there, didn't I?). The ability to do so is a good thing. I am not however sure about changing the default when no option is specified on the command line.

Show 14 quoted lines
>> > +	if ($smtp_server =~ m#^/#) {
>> 
>> I like this if(){}else{} here, but have a feeling that the
>> logging part should be placed outside it to be shared.
>
> Cleaned that up a bit, patch coming.  Also removed the Port: printout
> completely, as it's rather redundant (see below).
>
>> While we are at it, we might want to enhance $smtp_server parsing
>> to take host:port notation so that people can use message
>> submission port 587/tcp (RFC 4409) instead.
>
> This already works, IO::Socket::INET (behind Net::SMTP) takes care of
> it :)

Thanks. Maybe the next option would be delivery to a file (or even SMTP batch)? ;-)

Eric Wong· May 15, 2006, 10:11 UTC · re: Junio C Hamano · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Junio C Hamano <junkio@cox.net> wrote:
Show 11 quoted lines
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > I believe this is what Martin wanted.  I think it's a good idea since
> > sendmail binaries tend to be more flexible, but I'm ok with it either
> > way.
> 
> I am not opposed to have an option to run a local submission
> agent binary (I said I like that if(){}else{} there, didn't I?).
> The ability to do so is a good thing.  I am not however sure
> about changing the default when no option is specified on the
> command line.

By "I believe this is what Martin wanted", I meant changing the default to sendmail: <46a038f90604271804j195d62f3x93ae816e809f4ffd@mail.gmail.com>

	> Oh, it should just work with sendmail if it's there and we don't
	> provide --smtp-server ;-)
Show 17 quoted lines
> >> > +	if ($smtp_server =~ m#^/#) {
> >> 
> >> I like this if(){}else{} here, but have a feeling that the
> >> logging part should be placed outside it to be shared.
> >
> > Cleaned that up a bit, patch coming.  Also removed the Port: printout
> > completely, as it's rather redundant (see below).
> >
> >> While we are at it, we might want to enhance $smtp_server parsing
> >> to take host:port notation so that people can use message
> >> submission port 587/tcp (RFC 4409) instead.
> >
> > This already works, IO::Socket::INET (behind Net::SMTP) takes care of
> > it :)
> 
> Thanks.  Maybe the next option would be delivery to a file (or
> even SMTP batch)? ;-)

Sure :) Authentication and SSL may be worth looking into, though. I'm pretty content these days with my autossh tunnel to my mail server, though.

-- 
Eric Wong
Martin Langhoff· May 15, 2006, 10:37 UTC · re: Eric Wong · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

On 5/15/06, Eric Wong <normalperson@yhbt.net> wrote:
Show 11 quoted lines
> Junio C Hamano <junkio@cox.net> wrote:
> > I am not opposed to have an option to run a local submission
> > agent binary (I said I like that if(){}else{} there, didn't I?).
> > The ability to do so is a good thing.  I am not however sure
> > about changing the default when no option is specified on the
> > command line.
>
> By "I believe this is what Martin wanted", I meant changing the default to
> sendmail: <46a038f90604271804j195d62f3x93ae816e809f4ffd@mail.gmail.com>
>
>         > Oh, it should just work with sendmail if it's there and we don't

Thanks Eric! git-send-email used to default to using local binaries. It was only with the switch to Net::SMTP that the default changed to localhost:25. IMHO the developer's machine is more likely to have a working /usr/sbin/sendmail than an SMTP server (specially looking at current linux desktop configurations).

OTOH, as long as I can override it to use sendmail, it's all good.
martin
Junio C Hamano· May 15, 2006, 16:25 UTC · re: Martin Langhoff · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

"Martin Langhoff" <martin.langhoff@gmail.com> writes:
Show 16 quoted lines
> On 5/15/06, Eric Wong <normalperson@yhbt.net> wrote:
>> Junio C Hamano <junkio@cox.net> wrote:
>> > I am not opposed to have an option to run a local submission
>> > agent binary (I said I like that if(){}else{} there, didn't I?).
>> > The ability to do so is a good thing.  I am not however sure
>> > about changing the default when no option is specified on the
>> > command line.
>>
>> By "I believe this is what Martin wanted", I meant changing the default to
>> sendmail: <46a038f90604271804j195d62f3x93ae816e809f4ffd@mail.gmail.com>
>>
>>         > Oh, it should just work with sendmail if it's there and we don't
>
> Thanks Eric! git-send-email used to default to using local binaries.
> It was only with the switch to Net::SMTP that the default changed to
> localhost:25.
Thanks, and I think it makes sense.
Eric Wong· May 15, 2006, 19:10 UTC · re: Martin Langhoff · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Martin Langhoff <martin.langhoff@gmail.com> wrote:
> Thanks Eric! git-send-email used to default to using local binaries.
> It was only with the switch to Net::SMTP that the default changed to
> localhost:25.
You're welcome.

That's odd, though, looking at Mail::Sendmail, I don't think it actually uses the sendmail binary, either. The FAQ <http://alma.ch/perl/Mail-Sendmail-FAQ.html> confirms this, too.

Of course documentation may be lying and the code I'm looking at may be *very* well obfuscated :D

-- 
Eric Wong
Ryan Anderson· May 15, 2006, 21:01 UTC · re: Junio C Hamano · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

On Mon, May 15, 2006 at 02:47:31AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > I believe this is what Martin wanted.  I think it's a good idea since
> > sendmail binaries tend to be more flexible, but I'm ok with it either
> > way.
> 
> I am not opposed to have an option to run a local submission
> agent binary (I said I like that if(){}else{} there, didn't I?).
> The ability to do so is a good thing.  I am not however sure
> about changing the default when no option is specified on the
> command line.

I think, in practice, that /usr/lib/sendmail will exist anywhere you hve something running on port 25, at least on unixy machines. In my searches at an old job, that appeared to be the canonical place to call sendmail from, and every MTA appears to provide an appropriate binary there.

So, I'm not overly worried about it.
Junio C Hamano· May 15, 2006, 21:13 UTC · re: Ryan Anderson · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

Ryan Anderson <ryan@michonline.com> writes:
Show 7 quoted lines
> I think, in practice, that /usr/lib/sendmail will exist anywhere you hve
> something running on port 25, at least on unixy machines.  In my
> searches at an old job, that appeared to be the canonical place to call
> sendmail from, and every MTA appears to provide an appropriate binary
> there.
>
> So, I'm not overly worried about it.
exim, postfix and friends?

I used to know somebody who port-forwarded 25/tcp to central smtp server from smaller machines in her intranet installation, but I would say that is rare. I am not worried about it either; I just wanted to make sure _somebody_ thought the potential issues through and agreed with the change the patch makes.

Ryan Anderson· May 15, 2006, 21:52 UTC · re: Junio C Hamano · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

On Mon, May 15, 2006 at 02:13:25PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Ryan Anderson <ryan@michonline.com> writes:
> 
> > I think, in practice, that /usr/lib/sendmail will exist anywhere you hve
> > something running on port 25, at least on unixy machines.  In my
> > searches at an old job, that appeared to be the canonical place to call
> > sendmail from, and every MTA appears to provide an appropriate binary
> > there.
> >
> > So, I'm not overly worried about it.
> 
> exim, postfix and friends?

At least as packaged by Debian and Ubuntu, exim and postfix both fit that rule.

It's just that there is no other canonical name for the binary that provides the functionality, so everyone steals the name.

Show 5 quoted lines
> I used to know somebody who port-forwarded 25/tcp to central
> smtp server from smaller machines in her intranet installation,
> but I would say that is rare.  I am not worried about it either;
> I just wanted to make sure _somebody_ thought the potential
> issues through and agreed with the change the patch makes.
Fair enough.
Martin Langhoff· May 15, 2006, 22:07 UTC · re: Junio C Hamano · lore

Re: [PATCH] send-email: allow sendmail binary to be used instead of SMTP

On 5/16/06, Junio C Hamano <junkio@cox.net> wrote:
> Ryan Anderson <ryan@michonline.com> writes:
>
> > I think, in practice, that /usr/lib/sendmail will exist anywhere you hve
> > something running on port 25, at least on unixy machines.
...
> exim, postfix and friends?

/usr/sbin/sendmail is there for any current MTA, so if qmail, exim, postfix, sendmail and all MTAs I can think of install a working sendmail binary.

Newish desktop-targetted distros (and MacOSX) are leaning towards not running an MTA on port 25 any more unless you ask them for it. They'll do crontab-driven queue flushes, so the messages you feed to /usr/sbin/sendmail will be sent a few minutes later.

That is why IMHO /usr/sbin/sendmail is a better default than localhost:25, but I can live with either ;-)

> I used to know somebody who port-forwarded 25/tcp to central
> smtp server from smaller machines in her intranet installation,

I can understand that, but I think the changes in unixy distros mentioned above make it unnecessary today.

cheers,
martin

← back to recent threads