From: Eric Bollengier Date: Fri, 15 Jan 2021 10:10:48 +0000 (+0100) Subject: bsmtp: Add the possibility to add emails separated with a comma as recipient list X-Git-Tag: Release-11.3.2~779 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e9bfa63f0ceac1f35dba231c314ad85f2f3a53c;p=thirdparty%2Fbacula.git bsmtp: Add the possibility to add emails separated with a comma as recipient list --- diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index d1c5ecbdb..4a5aade93 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -589,8 +589,21 @@ lookup_host: chat("MAIL FROM:%s\r\n", cleanup_addr(from_addr, buf, sizeof(buf))); for (i = 0; i < argc; i++) { - Dmsg1(20, "rcpt to: %s\n", argv[i]); - chat("RCPT TO:%s\r\n", cleanup_addr(argv[i], buf, sizeof(buf))); + char *m = argv[i]; + if (m) { + /* email1,email2,email3 */ + for (char *end = strchr(m, ','); end ; end = strchr(m, ',')) { + *end = 0; + Dmsg1(20, "rcpt to: %s\n", argv[i]); + chat("RCPT TO:%s\r\n", cleanup_addr(m, buf, sizeof(buf))); + m = end+1; // Move forward + *end = ','; // Get the original string back + } + if (*m) { // We should have a last one + Dmsg1(20, "rcpt to: %s\n", argv[i]); + chat("RCPT TO:%s\r\n", cleanup_addr(m, buf, sizeof(buf))); + } + } } if (cc_addr) {