[PATCH] send-email: new 'add-envelope' option

Subsystems: the rest

DORMANTno replies

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] send-email: new 'add-envelope' option

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:47:45

Some MTAs make smart decisions based on the 'from' envelope (i.e. msmtp)

Signed-off-by: Felipe Contreras <redacted>
---
 git-send-email.perl |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index a0279de..92bf491 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -140,6 +140,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
 	$author,$sender,$smtp_authpass,$annotate,$compose,$time);
 
 my $envelope_sender;
+my $envelope_from;
 
 # Example reply to:
 #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -208,6 +209,7 @@ my %config_settings = (
     "aliasesfile" => \@alias_files,
     "suppresscc" => \@suppress_cc,
     "envelopesender" => \$envelope_sender,
+    "envelopefrom" => \$envelope_from,
     "multiedit" => \$multiedit,
     "confirm"   => \$confirm,
     "from" => \$sender,
@@ -265,6 +267,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "confirm=s" => \$confirm,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
+		    "envelope-from" => \$envelope_from,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
@@ -861,10 +864,13 @@ X-Mailer: git-send-email $gitversion
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sanitized_sender;
-	$raw_from = $envelope_sender if (defined $envelope_sender);
+	if (defined $envelope_sender) {
+		$raw_from = $envelope_sender;
+		$envelope_from = 1;
+	}
 	$raw_from = extract_valid_address($raw_from);
 	unshift (@sendmail_parameters,
-			'-f', $raw_from) if(defined $envelope_sender);
+			'-f', $raw_from) if(defined $envelope_from);
 
 	if ($needs_confirm && !$dry_run) {
 		print "\n$header\n";
-- 
1.6.5.3.1.ga9388c

Re: [PATCH] send-email: new 'add-envelope' option

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:47:45

On Sat, Nov 21, 2009 at 9:36 PM, Jeff King [off-list ref] wrote:
So my first thought was "how in the world is this different from setting
the envelope sender?"

Reading the code, it seems:
[...]
that this is a boolean to mean "use the from address as the envelope
sender".

It was of course all the more confusing for not being documented at all,
but even if documented,
Right, I forgot the one-liner for the help.
--envelope-from is IMHO confusingly similar to
--envelope-sender. Maybe --use-from-in-envelope would be a better name?
Ok. I don't have any opinion on the name.
And of course, your patch is missing docs and tests.
There are no tests for 'envelope-sender', so I don't think it should
be a requirement for this patch to do so. I'll add the documentation
though.

Will resend v2.

-- 
Felipe Contreras

Re: [PATCH] send-email: new 'add-envelope' option

From: Jeff King <hidden>
Date: 2016-06-15 22:47:45

On Sat, Nov 21, 2009 at 07:43:30PM +0200, Felipe Contreras wrote:
Some MTAs make smart decisions based on the 'from' envelope (i.e. msmtp)
So my first thought was "how in the world is this different from setting
the envelope sender?"

Reading the code, it seems:
-	$raw_from = $envelope_sender if (defined $envelope_sender);
+	if (defined $envelope_sender) {
+		$raw_from = $envelope_sender;
+		$envelope_from = 1;
+	}
 	$raw_from = extract_valid_address($raw_from);
 	unshift (@sendmail_parameters,
-			'-f', $raw_from) if(defined $envelope_sender);
+			'-f', $raw_from) if(defined $envelope_from);
that this is a boolean to mean "use the from address as the envelope
sender".

It was of course all the more confusing for not being documented at all,
but even if documented, --envelope-from is IMHO confusingly similar to
--envelope-sender. Maybe --use-from-in-envelope would be a better name?

And of course, your patch is missing docs and tests.

-Peff

Re: [PATCH] send-email: new 'add-envelope' option

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:47:45

On Sat, Nov 21, 2009 at 9:59 PM, Felipe Contreras
[off-list ref] wrote:
On Sat, Nov 21, 2009 at 9:36 PM, Jeff King [off-list ref] wrote:
quoted
--envelope-from is IMHO confusingly similar to
--envelope-sender. Maybe --use-from-in-envelope would be a better name?
Ok. I don't have any opinion on the name.
I thought a bit more about this, and in the end what we really want is
to add the sender envelope. The most typical case would be to use the
'from' address, but we should be able to override it (we do both by
using --envelope-sender).

So here are other options.

a) --add-envelope: add the sender envelope, by default it would be the
'from' address, but could be overridden by --envelope-sender.

b) --envelope-sender="" or "auto": this would require minimal changes
but looks a bit strange.

Any thoughts?

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help