aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mailutils/sendmail.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 36a1b97cb..d58f503a0 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -365,7 +365,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
365 continue; // N.B. Bcc: vanishes from headers! 365 continue; // N.B. Bcc: vanishes from headers!
366 } 366 }
367 } 367 }
368 check_hdr = list && isspace(s[0]); 368 check_hdr = (list && isspace(s[0]));
369 if (strchr(s, ':') || check_hdr) { 369 if (strchr(s, ':') || check_hdr) {
370 // other headers go verbatim 370 // other headers go verbatim
371 // N.B. RFC2822 2.2.3 "Long Header Fields" allows for headers to occupy several lines. 371 // N.B. RFC2822 2.2.3 "Long Header Fields" allows for headers to occupy several lines.
@@ -389,14 +389,27 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
389 // so stop "analyze headers" mode 389 // so stop "analyze headers" mode
390 reenter: 390 reenter:
391 // put recipients specified on cmdline 391 // put recipients specified on cmdline
392 check_hdr = 1;
392 while (*argv) { 393 while (*argv) {
393 char *t = sane_address(*argv); 394 char *t = sane_address(*argv);
394 rcptto(t); 395 rcptto(t);
395 //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS) 396 //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS)
396 // goto bail; 397 // goto bail;
397 if (!has_to) 398 if (!has_to) {
399 const char *hdr;
400
401 if (check_hdr && argv[1])
402 hdr = "To: %s,";
403 else if (check_hdr)
404 hdr = "To: %s";
405 else if (argv[1])
406 hdr = "To: %s," + 3;
407 else
408 hdr = "To: %s" + 3;
398 llist_add_to_end(&list, 409 llist_add_to_end(&list,
399 xasprintf("To: %s", t)); 410 xasprintf(hdr, t));
411 check_hdr = 0;
412 }
400 argv++; 413 argv++;
401 } 414 }
402 // enter "put message" mode 415 // enter "put message" mode