[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[msmtp-users] Removing Bcc from header



Hello,
 
I recently found a bug in msmtp (the embarrassing way, 
unfortunately). msmtp does not handle Bccs correctly if there are
multiple consecutive lines starting with "Bcc:", it only removes every
second of these lines.
 
The attached patch that should fix the problem.
 
Martin
diff --git a/src/smtp.c b/src/smtp.c
index 71c249e..0a7409e 100644
--- a/src/smtp.c
+++ b/src/smtp.c
@@ -1632,16 +1632,13 @@ int smtp_send_mail(smtp_server_t *srv, FILE *mailf, int keep_bcc,
             {
                 if (line_starts)
                 {
-                    if (!in_bcc)
+                    if (strncasecmp(buffer, "Bcc:", 4) == 0)
                     {
-                        if (strncasecmp(buffer, "Bcc:", 4) == 0)
-                        {
-                            in_bcc = 1;
-                            /* remove Bcc header by ignoring this line */
-                            continue;
-                        }
+                        in_bcc = 1;
+                        /* remove Bcc header by ignoring this line */
+                        continue;
                     }
-                    else
+                    else if (in_bcc)
                     {
                         /* continued header lines begin with "horizontal
                          * whitespace" (RFC 2822, section 2.2.3) */