diff --git a/ssmtp.c b/ssmtp.c index af4d1e5..6ecde0b 100644 --- a/ssmtp.c +++ b/ssmtp.c @@ -1409,6 +1409,8 @@ ssmtp() -- send the message (exactly one) from stdin to the mailhub SMTP port int ssmtp(char *argv[]) { char b[(BUF_SZ + 2)], *buf = b+1, *p, *q; + char *to_list = NULL; + size_t to_list_len = 0; #ifdef MD5AUTH char challenge[(BUF_SZ + 1)]; #endif @@ -1567,6 +1569,8 @@ int ssmtp(char *argv[]) while(rt->next) { p = rcpt_remap(rt->string); outbytes += smtp_write(sock, "RCPT TO:<%s>", p); + to_list = realloc(to_list, to_list_len + strlen(p) + 2); + to_list_len += sprintf(&to_list[to_list_len], "%s%s", to_list_len ? ", " : "", p); (void)alarm((unsigned)MEDWAIT); @@ -1584,6 +1588,8 @@ int ssmtp(char *argv[]) /* RFC822 Address -> "foo@bar" */ q = rcpt_remap(addr_parse(p)); outbytes += smtp_write(sock, "RCPT TO:<%s>", q); + to_list = realloc(to_list, to_list_len + strlen(p) + 2); + to_list_len += sprintf(&to_list[to_list_len], "%s%s", to_list_len ? ", " : "", p); (void)alarm((unsigned) MEDWAIT); @@ -1686,8 +1692,8 @@ int ssmtp(char *argv[]) (void)smtp_okay(sock, buf); (void)close(sock); - log_event(LOG_INFO, "Sent mail for %s (%s) uid=%d username=%s outbytes=%d", - from_strip(uad), buf, uid, pw->pw_name, outbytes); + log_event(LOG_INFO, "Sent mail for %s to %s (%s) uid=%d username=%s outbytes=%d", + from_strip(uad), to_list, buf, uid, pw->pw_name, outbytes); return(0); }