aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/sendmail.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/networking/sendmail.c b/networking/sendmail.c
index 2332f6afb..653f2e60a 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -375,6 +375,7 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
375 const char *p; 375 const char *p;
376 char *q; 376 char *q;
377 llist_t *l; 377 llist_t *l;
378 llist_t *headers = NULL;
378 379
379 // recipients specified as arguments 380 // recipients specified as arguments
380 while (*argv) { 381 while (*argv) {
@@ -390,6 +391,7 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
390 // N.B. subject read from body has priority 391 // N.B. subject read from body has priority
391 // over that specified on command line. 392 // over that specified on command line.
392 // recipients are merged 393 // recipients are merged
394 // N.B. other headers are collected and will be dumped verbatim
393 if (opts & OPTS_t || !opt_recipients) { 395 if (opts & OPTS_t || !opt_recipients) {
394 // fetch recipients and (optionally) subject 396 // fetch recipients and (optionally) subject
395 char *s; 397 char *s;
@@ -402,11 +404,12 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
402*/ } else if (0 == strncmp("Subject: ", s, 9)) { 404*/ } else if (0 == strncmp("Subject: ", s, 9)) {
403 opt_subject = s+9; 405 opt_subject = s+9;
404 opts |= OPTS_s; 406 opts |= OPTS_s;
407 } else if (s[0]) {
408 // misc header
409 llist_add_to_end(&headers, s);
405 } else { 410 } else {
406 char first = s[0];
407 free(s); 411 free(s);
408 if (!first) 412 break; // empty line
409 break; // empty line
410 } 413 }
411 } 414 }
412 } 415 }
@@ -476,6 +479,11 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
476 if (opts & OPTS_N) 479 if (opts & OPTS_N)
477 printf("Disposition-Notification-To: %s\r\n", opt_from); 480 printf("Disposition-Notification-To: %s\r\n", opt_from);
478 481
482 // put headers we could have preread with -t
483 for (l = headers; l; l = l->link) {
484 printf("%s\r\n", l->data);
485 }
486
479 // make a random string -- it will delimit message parts 487 // make a random string -- it will delimit message parts
480 srand(monotonic_us()); 488 srand(monotonic_us());
481 boundary = xasprintf("%d-%d-%d", rand(), rand(), rand()); 489 boundary = xasprintf("%d-%d-%d", rand(), rand(), rand());