aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mailutils/sendmail.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 22f735b3d..36a1b97cb 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -187,6 +187,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
187 HDR_BCC, 187 HDR_BCC,
188 } last_hdr = 0; 188 } last_hdr = 0;
189 int check_hdr; 189 int check_hdr;
190 int has_to = 0;
190 191
191 enum { 192 enum {
192 //--- standard options 193 //--- standard options
@@ -348,8 +349,10 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
348 349
349 // analyze headers 350 // analyze headers
350 // To: or Cc: headers add recipients 351 // To: or Cc: headers add recipients
352 check_hdr = 0 == strncasecmp("To:", s, 3);
353 has_to |= check_hdr;
351 if (opts & OPT_t) { 354 if (opts & OPT_t) {
352 if (0 == strncasecmp("To:", s, 3) || 0 == strncasecmp("Bcc:" + 1, s, 3)) { 355 if (check_hdr || 0 == strncasecmp("Bcc:" + 1, s, 3)) {
353 rcptto_list(s+3); 356 rcptto_list(s+3);
354 last_hdr = HDR_TOCC; 357 last_hdr = HDR_TOCC;
355 goto addheader; 358 goto addheader;
@@ -391,7 +394,9 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
391 rcptto(t); 394 rcptto(t);
392 //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS) 395 //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS)
393 // goto bail; 396 // goto bail;
394 llist_add_to_end(&list, xasprintf("To: %s", t)); 397 if (!has_to)
398 llist_add_to_end(&list,
399 xasprintf("To: %s", t));
395 argv++; 400 argv++;
396 } 401 }
397 // enter "put message" mode 402 // enter "put message" mode