summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.h10
-rw-r--r--mutt.h1
-rw-r--r--protos.h2
-rw-r--r--send.c4
-rw-r--r--sendlib.c13
5 files changed, 25 insertions, 5 deletions
diff --git a/init.h b/init.h
index 9895783d..a6bb84ec 100644
--- 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 5d9d1a0a..44935855 100644
--- a/mutt.h
+++ b/mutt.h
@@ -284,6 +284,7 @@ enum
OPTDELETEUNTAG,
OPTEDITHDRS,
OPTENCODEFROM,
+ OPTENVFROM,
OPTFASTREPLY,
OPTFCCATTACH,
OPTFCCCLEAR,
diff --git a/protos.h b/protos.h
index 8a8c2ac7..6cfcb53d 100644
--- 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 b9de93f2..a507d173 100644
--- 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);
}
diff --git a/sendlib.c b/sendlib.c
index 9aa49c21..ecefe7f8 100644
--- 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)