When emailing multiple addresses, put one in To: and the rest in CC: (#2310).
authorCarl Hetherington <cth@carlh.net>
Sat, 17 Sep 2022 21:36:26 +0000 (23:36 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 17 Sep 2022 21:36:26 +0000 (23:36 +0200)
src/lib/kdm_with_metadata.cc

index bebb5df86d0b44f6af12a2c5f371d2e2620eed6e..7dee935c4a0346c2b11b97aee5e2268f87055baf 100644 (file)
@@ -250,7 +250,13 @@ send_emails (
                }
                boost::algorithm::replace_all (body, "$SCREENS", screens.substr (0, screens.length() - 2));
 
-               Emailer email (config->kdm_from(), first->emails(), subject, body);
+               auto emails = first->emails();
+               Emailer email (config->kdm_from(), { emails.front() }, subject, body);
+
+               /* Use CC for the second and subsequent email addresses, so we seem less spammy (#2310) */
+               for (auto cc = std::next(emails.begin()); cc != emails.end(); ++cc) {
+                       email.add_cc(*cc);
+               }
 
                for (auto cc: config->kdm_cc()) {
                        email.add_cc (cc);