diff --git a/alias.c b/alias.c index a860696e8..a5199d9ef 100644 --- a/alias.c +++ b/alias.c @@ -139,6 +139,17 @@ ADDRESS *mutt_expand_aliases (ADDRESS *a) return (t); } +void mutt_expand_aliases_env (ENVELOPE *env) +{ + env->from = mutt_expand_aliases (env->from); + env->to = mutt_expand_aliases (env->to); + env->cc = mutt_expand_aliases (env->cc); + env->bcc = mutt_expand_aliases (env->bcc); + env->reply_to = mutt_expand_aliases (env->reply_to); + env->mail_followup_to = mutt_expand_aliases (env->mail_followup_to); +} + + /* * if someone has an address like * From: Michael `/bin/rm -f ~` Elkins diff --git a/headers.c b/headers.c index 843b3bba2..38542d79c 100644 --- a/headers.c +++ b/headers.c @@ -101,13 +101,8 @@ void mutt_edit_headers (const char *editor, mutt_free_envelope (&msg->env); msg->env = n; - msg->env->from = mutt_expand_aliases (msg->env->from); - msg->env->to = mutt_expand_aliases (msg->env->to); - msg->env->cc = mutt_expand_aliases (msg->env->cc); - msg->env->bcc = mutt_expand_aliases (msg->env->bcc); - msg->env->reply_to = mutt_expand_aliases (msg->env->reply_to); - msg->env->mail_followup_to = mutt_expand_aliases (msg->env->mail_followup_to); - + mutt_expand_aliases_env (msg->env); + /* search through the user defined headers added to see if either a * fcc: or attach-file: field was specified. */ diff --git a/protos.h b/protos.h index b7380b97d..540f68bae 100644 --- a/protos.h +++ b/protos.h @@ -144,6 +144,7 @@ void mutt_edit_file (const char *, const char *); void mutt_edit_headers (const char *, const char *, HEADER *, char *, size_t); void mutt_curses_error (const char *, ...); void mutt_enter_command (void); +void mutt_expand_aliases_env (ENVELOPE *); void mutt_expand_file_fmt (char *, size_t, const char *, const char *); void mutt_expand_fmt (char *, size_t, const char *, const char *); void mutt_expand_link (char *, const char *, const char *); diff --git a/send.c b/send.c index b2de64c15..0b899cf32 100644 --- a/send.c +++ b/send.c @@ -1042,9 +1042,7 @@ ci_send_message (int flags, /* send mode */ if (msg) { - msg->env->to = mutt_expand_aliases (msg->env->to); - msg->env->cc = mutt_expand_aliases (msg->env->cc); - msg->env->bcc = mutt_expand_aliases (msg->env->bcc); + mutt_expand_aliases_env (msg->env); } else {