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

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

 



Eric Wong <normalperson@xxxxxxxx> 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.

> +	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.

-
: 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]