From: Art Cancro Date: Mon, 28 May 2007 04:53:50 +0000 (+0000) Subject: Began implementation of sendmail -t option (not finished) X-Git-Tag: v7.86~3353 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=e1cccf27e5d8cad0720f5d39d806832fc184f367;p=citadel.git Began implementation of sendmail -t option (not finished) --- diff --git a/citadel/citmail.c b/citadel/citmail.c index 58c0a61e4..63f75bd3d 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -176,11 +176,24 @@ int main(int argc, char **argv) { char ctdldir[PATH_MAX]=CTDLDIR; char *sp, *ep; char hostname[256]; + char **recipients = NULL; + int num_recipients = 0; + int to_or_cc = 0; + int read_recipients_from_headers = 0; + char *add_these_recipients = NULL; for (i=1; ipw_name, - hostname - ); + snprintf(fromline, sizeof fromline, "From: %s@%s", pw->pw_name, hostname); while (fgets(buf, 1024, stdin) != NULL) { if ( ( (buf[0] == 13) || (buf[0] == 10)) && (in_body == 0) ) { in_body = 1; @@ -219,6 +235,29 @@ int main(int argc, char **argv) { from_header = 1; } } + + if (read_recipients_from_headers) { + add_these_recipients = NULL; + if ((isspace(buf[0])) && (to_or_cc)) { + add_these_recipients = buf; + } + else { + if ((!strncasecmp(buf, "To:", 3)) || (!strncasecmp(buf, "Cc:", 3))) { + to_or_cc = 1; + } + else { + to_or_cc = 0; + } + if (to_or_cc) { + add_these_recipients = &buf[3]; + } + } + + if (add_these_recipients) { + /* FIXME do something with them */ + } + } + fprintf(fp, "%s", buf); } strip_trailing_nonprint(fromline); @@ -236,14 +275,13 @@ int main(int argc, char **argv) { serv_gets(buf); if (buf[0] != '2') cleanup(1); - for (i=1; i