Derek Martin | 15 Oct 19:31
Gravatar

write_bcc and fcc

For users who use Exim or other MTAs that don't strip bcc headers,
normally you must set write_bcc=no so that your bcc headers won't show
up in messages unintentionally.  However this also has the effect of
preventing the Bcc line from showing up in your saved mail.

I've written a patch against the latest CVS so that the Bcc line is
always written to the fcc (saved mailbox) regardless of the value of
$write_bcc which allows you to see who your Bcc recipients were when
reviewing your sent mail.  I suspect it will also apply against any
recent version of mutt, since the affected code probably hasn't
changed in a long time.  I've tested it with no problems, but feel
free to provide feedback if you have trouble with it.  

The patch is attached.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail.  Sorry for the inconvenience.  Thank the spammers.

diff -r -u mutt-cvs-2005-10-15/headers.c mutt-cvs-2005-10-15.ddm/headers.c
--- mutt-cvs-2005-10-15/headers.c	2005-09-17 16:46:10.000000000 -0400
+++ mutt-cvs-2005-10-15.ddm/headers.c	2005-10-15 13:05:49.000000000 -0400
@@ -52,7 +52,7 @@
   }

   mutt_env_to_local (msg->env);
-  mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0);
+  mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0, 0);
   fputc ('\n', ofp);	/* tie off the header. */

   /* now copy the body of the message. */
diff -r -u mutt-cvs-2005-10-15/protos.h mutt-cvs-2005-10-15.ddm/protos.h
--- mutt-cvs-2005-10-15/protos.h	2005-10-04 02:05:39.000000000 -0400
+++ mutt-cvs-2005-10-15.ddm/protos.h	2005-10-15 13:06:10.000000000 -0400
@@ -353,7 +353,7 @@
 int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int, char *);
 int mutt_write_mime_body (BODY *, FILE *);
 int mutt_write_mime_header (BODY *, FILE *);
-int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int);
+int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int, int);
 int mutt_yesorno (const char *, int);
 void mutt_set_header_color(CONTEXT *, HEADER *);
 void mutt_sleep (short);
diff -r -u mutt-cvs-2005-10-15/send.c mutt-cvs-2005-10-15.ddm/send.c
--- mutt-cvs-2005-10-15/send.c	2005-10-03 03:52:00.000000000 -0400
+++ mutt-cvs-2005-10-15.ddm/send.c	2005-10-15 13:06:46.000000000 -0400
@@ -969,10 +969,10 @@
     return (-1);

 #ifdef MIXMASTER
-  mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0);
+  mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0, 0);
 #endif
 #ifndef MIXMASTER
-  mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0);
+  mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0, 0);
 #endif

   fputc ('\n', tempfp); /* tie off the header. */
diff -r -u mutt-cvs-2005-10-15/sendlib.c mutt-cvs-2005-10-15.ddm/sendlib.c
--- mutt-cvs-2005-10-15/sendlib.c	2005-09-29 19:02:49.000000000 -0400
+++ mutt-cvs-2005-10-15.ddm/sendlib.c	2005-10-15 13:04:22.000000000 -0400
@@ -1531,10 +1531,12 @@
  *               Output generated is suitable for being sent through
  * 		 anonymous remailer chains.
  *
+ * fcc != 0 => force writing of bcc, even if $write_bcc=no (for fcc)
+ *
  */

 int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, 
-			      int mode, int privacy)
+			      int mode, int privacy, int fcc)
 {
   char buffer[LONG_STRING];
   char *p;
@@ -1572,7 +1574,7 @@

   if (env->bcc)
   {
-    if(mode != 0 || option(OPTWRITEBCC))
+    if(mode != 0 || option(OPTWRITEBCC) || fcc)
     {
       fputs ("Bcc: ", fp);
       mutt_write_address_list (env->bcc, fp, 5, 0);
@@ -2319,7 +2321,7 @@
   /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header()
    * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header() 
    * */
-  mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0);
+  mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0, 1);

   /* (postponment) if this was a reply of some sort, <msgid> contians the
    * Message-ID: of message replied to.  Save it using a special X-Mutt-

Gmane