]> granicus.if.org Git - neomutt/commitdiff
Adding the envelope_from option.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 13 Dec 1999 11:36:01 +0000 (11:36 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 13 Dec 1999 11:36:01 +0000 (11:36 +0000)
init.h
mutt.h
protos.h
send.c
sendlib.c

diff --git a/init.h b/init.h
index 9895783d72248724f3bb9dbfea353493e2e23a44..a6bb84ec5752b900aa9c7c6e2936639853e5fc5d 100644 (file)
--- a/init.h
+++ b/init.h
@@ -410,6 +410,16 @@ 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 },
+  /*
+  ** .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.
+  */
   { "escape",          DT_STR,  R_NONE, UL &EscChar, UL "~" },
   /*
   ** .pp
diff --git a/mutt.h b/mutt.h
index 5d9d1a0ace5d3e72b7bff2d548cc35a17c8916ae..44935855f4ff8d67e5f66e4c0b8ab15aa0d44367 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -284,6 +284,7 @@ enum
   OPTDELETEUNTAG,
   OPTEDITHDRS,
   OPTENCODEFROM,
+  OPTENVFROM,
   OPTFASTREPLY,
   OPTFCCATTACH,
   OPTFCCCLEAR,
index 8a8c2ac72753d574723e85fb8e8a2fcbb52257fa..6cfcb53d3c98b25c188e0fe20cc08da4ff7f59fb 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -241,7 +241,7 @@ int mutt_get_password (char *, char *, size_t);
 int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
 int mutt_get_tmp_attachment (BODY *);
 int mutt_index_menu (void);
-int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
+int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
 int mutt_is_autoview (BODY *, const char *);
 int mutt_is_mail_list (ADDRESS *);
 int mutt_is_message_type(int, const char *);
diff --git a/send.c b/send.c
index b9de93f2797617cd4542f847863a898415794d3e..a507d1738e2b2fb48a1b926dc09406a79bcff735 100644 (file)
--- a/send.c
+++ b/send.c
@@ -898,8 +898,8 @@ static int send_message (HEADER *msg)
     return mix_send_message (msg->chain, tempfile);
 #endif
 
-  i = mutt_invoke_sendmail (msg->env->to, msg->env->cc, msg->env->bcc,
-                      tempfile, (msg->content->encoding == ENC8BIT));
+  i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc, 
+                           msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT));
   return (i);
 }
 
index 9aa49c213193b55b9c23508999a61df7d5d45dfd..ecefe7f8985c6a454a59f9eb785d3b813cb3281c 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1629,7 +1629,8 @@ strsysexit(int e)
 
 
 int
-mutt_invoke_sendmail (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
+mutt_invoke_sendmail (ADDRESS *from,   /* the sender */
+                ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
                 const char *msg, /* file containing message */
                 int eightbit) /* message contains 8bit chars */
 {
@@ -1660,8 +1661,15 @@ mutt_invoke_sendmail (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
     ps = NULL;
     i++;
   }
+
   if (eightbit && option (OPTUSE8BITMIME))
     args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
+
+  if (option (OPTENVFROM) && 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");
@@ -1850,7 +1858,8 @@ static void _mutt_bounce_message (FILE *fp, HEADER *h, ADDRESS *to, const char *
     mutt_copy_bytes (fp, f, h->content->length);
     fclose (f);
 
-    mutt_invoke_sendmail (to, NULL, NULL, tempfile, h->content->encoding == ENC8BIT);
+    mutt_invoke_sendmail (NULL, to, NULL, NULL, tempfile, 
+                         h->content->encoding == ENC8BIT);
   }
 
   if (msg)