int rc, mfhrc, oldmsgcount;
int fetchlast = 0;
int maxuid = 0;
- static const char * const want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL X-KEYWORDS X-MOZILLA-KEYS KEYWORDS";
+ static const char * const want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL X-KEYWORDS X-MOZILLA-KEYS KEYWORDS X-ORIGINAL-TO";
progress_t progress;
int retval = -1;
** header field to the list address and you want to send a private
** message to the author of a message.
*/
+ { "reply_with_xorig", DT_BOOL, R_NONE, OPTREPLYWITHXORIG, 0 },
+ /*
+ ** .pp
+ ** This variable provides a toggle. When active, the From: header will be
+ ** extracted from the current mail's `X-Original-To:' header. This setting
+ ** does not have precedence over ``$reverse_realname''.
+ ** .pp
+ ** Assuming `fast_reply' is disabled, this option will prompt the user with a
+ ** prefilled From: header.
+ */
{ "resolve", DT_BOOL, R_NONE, OPTRESOLVE, 1 },
/*
** .pp
OPTREFLOWSPACEQUOTES,
OPTREFLOWTEXT,
OPTREPLYSELF,
+ OPTREPLYWITHXORIG,
OPTRESOLVE,
OPTRESUMEDRAFTFILES,
OPTRESUMEEDITEDDRAFTFILES,
ADDRESS *sender;
ADDRESS *reply_to;
ADDRESS *mail_followup_to;
+ ADDRESS *x_original_to;
char *list_post; /* this stores a mailto URL, or nothing */
char *subject;
char *real_subj; /* offset of the real subject */
MOVE_ELEM(supersedes);
MOVE_ELEM(date);
MOVE_ELEM(labels);
+ MOVE_ELEM(x_original_to);
if (!base->refs_changed)
{
MOVE_ELEM(references);
matched = 1;
}
#endif
+ else if (!ascii_strcasecmp (line + 1, "-original-to"))
+ {
+ e->x_original_to = rfc822_parse_adrlist (e->x_original_to, p);
+ matched = 1;
+ }
default:
break;
rfc2047_decode_adrlist (e->mail_followup_to);
rfc2047_decode_adrlist (e->return_path);
rfc2047_decode_adrlist (e->sender);
+ rfc2047_decode_adrlist (e->x_original_to);
if (e->subject)
{
return (-1);
if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
return (-1);
+ if (option (OPTREPLYWITHXORIG) &&
+ (flags & (SENDREPLY|SENDLISTREPLY|SENDGROUPREPLY)) &&
+ (edit_address (&en->from, "From: ") == -1))
+ return (-1);
}
if (en->subject)
* have their aliases expanded.
*/
+ if (msg->env->from)
+ dprint (5, (debugfile, "ci_send_message: msg->env->from before set_reverse_name: %s\n", msg->env->from->mailbox));
msg->env->from = set_reverse_name (cur->env);
}
+ if (cur && option (OPTREPLYWITHXORIG) && !(flags & (SENDPOSTPONED|SENDRESEND|SENDFORWARD)))
+ {
+ /* We shouldn't have to worry about freeing `msg->env->from' before
+ * setting it here since this code will only execute when doing some
+ * sort of reply. The pointer will only be set when using the -H command
+ * line option.
+ *
+ * If there is already a from address recorded in `msg->env->from',
+ * then it theoretically comes from OPTREVNAME handling, and we don't use
+ * the `X-Orig-To header'.
+ */
+ if (cur->env->x_original_to && !msg->env->from)
+ {
+ msg->env->from = cur->env->x_original_to;
+ /* Not more than one from address */
+ msg->env->from->next = NULL;
+ dprint (5, (debugfile, "ci_send_message: msg->env->from extracted from X-Original-To: header: %s\n", msg->env->from->mailbox));
+ }
+ }
if (! (flags & (SENDPOSTPONED|SENDRESEND)) &&
! ((flags & SENDDRAFTFILE) && option (OPTRESUMEDRAFTFILES)))