From 27f39f1e62375fdd22f4cecab4883b0ad764b361 Mon Sep 17 00:00:00 2001 From: "m@mmmmarascio.xyz" Date: Thu, 14 Jan 2016 14:41:26 -0700 Subject: [PATCH] Add existing "From:" to Bcc-ed messages. If you use multible mailboxes, the correct one is now used for Bcc-messages. --- uip/spost.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uip/spost.c b/uip/spost.c index 7729e9b..4a24fc4 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -117,6 +117,7 @@ static enum { static char *tmpfil; static char *subject = NULL; /* the subject field for BCC'ing */ +static struct mailname *from = NULL; /* the from field for BCC'ing */ static char fccs[BUFSIZ] = ""; struct mailname *bccs = NULL; /* list of the bcc recipients */ struct mailname *recipients = NULL; /* list of the recipients */ @@ -435,11 +436,11 @@ putfmt(char *name, char *str, FILE *out) /* needed because the address parser holds global state */ ismymbox(NULL); - for ( mp = addr_start.m_next; mp; mp = mp->m_next) { + for (mp = addr_start.m_next; mp; mp = mp->m_next) { if (ismymbox(mp)) { msgflags |= MFMM; if (my == NULL) { - my = mp; + from = my = mp; } } } @@ -667,6 +668,9 @@ process_bccs(char *origmsg) for (mp=bccs; mp; mp=mp->m_next) { bccdraft = getcpy(m_mktemp2("/tmp/", invo_name, NULL, &out)); fprintf(out, "To: %s\n", mp->m_text); + if (from) { + fprintf(out, "From: %s\n", from->m_text); + } fprintf(out, "Subject: [BCC] %s", subject ? subject : ""); fprintf(out, "%s: %s\n", attach_hdr, origmsg); fprintf(out, "------------\n"); -- 1.7.10.4