]> granicus.if.org Git - mutt/commitdiff
Add new $envelope_from_address variable for manually specifying the
authorBrendan Cully <brendan@kublai.com>
Wed, 14 Sep 2005 02:45:44 +0000 (02:45 +0000)
committerBrendan Cully <brendan@kublai.com>
Wed, 14 Sep 2005 02:45:44 +0000 (02:45 +0000)
envelope sender. Rename (with compatibility synonym) $envelope_from
to $use_envelope_from. Make $envelope_from subordinate to $use_e_f, as
$from is to $use_from. From a discussion with TLR.

globals.h
init.h
sendlib.c

index 942288dbfc196ec1dd76bac325aa2eef300c05ad..3f6879f79b2e60637b2c354ef279ed8b128ae99f 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -28,6 +28,7 @@ WHERE char AttachmentMarker[STRING];
 WHERE char *MuttDotlock;
 #endif
 
+WHERE ADDRESS *EnvFrom;
 WHERE ADDRESS *From;
 
 WHERE char *AliasFile;
diff --git a/init.h b/init.h
index 8d1176c271696d13637e02c51ae1e6cb5675b5f8..5087d17269489777ca6e37b46a7cebd6d85e8e92 100644 (file)
--- a/init.h
+++ b/init.h
@@ -538,15 +538,11 @@ struct option_t MuttVars[] = {
   ** Useful to avoid the tampering certain mail delivery and transport
   ** agents tend to do with messages.
   */
-  { "envelope_from",   DT_BOOL, R_NONE, OPTENVFROM, 0 },
+  { "envelope_from_address", DT_ADDR, R_NONE, UL &EnvFrom, 0 },
   /*
   ** .pp
-  ** When \fIset\fP, mutt will try to derive the message's \fIenvelope\fP
-  ** sender from the "From:" header.  Note that this information is passed 
-  ** to sendmail command using the "-f" command line switch, so don't set this
-  ** option if you are using that switch in $$sendmail yourself,
-  ** or if the sendmail on your machine doesn't support that command
-  ** line switch.
+  ** Manually sets the \fIenvelope\fP sender for outgoing messages.
+  ** This value is ignored if ``$$envelope_from'' is unset.
   */
   { "escape",          DT_STR,  R_NONE, UL &EscChar, UL "~" },
   /*
@@ -2792,6 +2788,20 @@ struct option_t MuttVars[] = {
   ** @host portion) with the value of ``$$hostname''.  If \fIunset\fP, no
   ** addresses will be qualified.
   */
+  { "use_envelope_from",       DT_BOOL, R_NONE, OPTENVFROM, 0 },
+  /*
+   ** .pp
+   ** When \fIset\fP, mutt will use ``$$envelope_from_address'' as the
+   ** \fIenvelope\fP sender if that is set, otherwise it will attempt to
+   ** derive it from the "From:" header.  Note that this information is passed 
+   ** to sendmail command using the "-f" command line switch, so don't set this
+   ** option if you are using that switch in $$sendmail yourself,
+   ** or if the sendmail on your machine doesn't support that command
+   ** line switch.
+   */
+  { "envelope_from",   DT_SYN,  R_NONE, UL "use_envelope_from", 0 },
+  /*
+  */
   { "use_from",                DT_BOOL, R_NONE, OPTUSEFROM, 1 },
   /*
   ** .pp
index 50209a5b2bdd3da920fef194567fc2cd699a2b8d..19a5684948f5ea6213f678d7aeb0ff8f6da0cf76 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1952,11 +1952,20 @@ mutt_invoke_sendmail (ADDRESS *from,    /* the sender */
   if (eightbit && option (OPTUSE8BITMIME))
     args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
 
-  if (option (OPTENVFROM) && from && !from->next)
+  if (option (OPTENVFROM))
   {
-    args = add_option (args, &argslen, &argsmax, "-f");
-    args = add_args   (args, &argslen, &argsmax, from);
+    if (EnvFrom)
+    {
+      args = add_option (args, &argslen, &argsmax, "-f");
+      args = add_args   (args, &argslen, &argsmax, EnvFrom);
+    }
+    else if (from && !from->next)
+    {
+      args = add_option (args, &argslen, &argsmax, "-f");
+      args = add_args   (args, &argslen, &argsmax, from);
+    }
   }
+
   if (DsnNotify)
   {
     args = add_option (args, &argslen, &argsmax, "-N");