summaryrefslogtreecommitdiff
path: root/src/lib/emailer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-13 13:07:16 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-13 13:07:16 +0000
commitdf89a39cfd34d0d70609daa214d3b618bb6223bd (patch)
tree1629307cc535fc0ea8804ca935022dddf163135d /src/lib/emailer.cc
parent43800d83434697a31bdfae62dd377cfc3900986b (diff)
Allow multiple recipients of KDM emails (#745).
Diffstat (limited to 'src/lib/emailer.cc')
-rw-r--r--src/lib/emailer.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/emailer.cc b/src/lib/emailer.cc
index 916d17182..885171e2f 100644
--- a/src/lib/emailer.cc
+++ b/src/lib/emailer.cc
@@ -38,7 +38,7 @@ using std::cout;
using std::pair;
using boost::shared_ptr;
-Emailer::Emailer (string from, string to, string subject, string body)
+Emailer::Emailer (string from, list<string> to, string subject, string body)
: _from (from)
, _to (to)
, _subject (subject)
@@ -106,7 +106,7 @@ Emailer::send (shared_ptr<Job> job)
stringstream email;
email << "Date: " << date_buffer << "\r\n"
- << "To: " << _to << "\r\n"
+ << "To: " << address_list (_to) << "\r\n"
<< "From: " << _from << "\r\n";
if (!_cc.empty ()) {
@@ -194,7 +194,10 @@ Emailer::send (shared_ptr<Job> job)
curl_easy_setopt (curl, CURLOPT_MAIL_FROM, _from.c_str());
- struct curl_slist* recipients = curl_slist_append (0, _to.c_str());
+ struct curl_slist* recipients = 0;
+ BOOST_FOREACH (string i, _to) {
+ curl_slist_append (recipients, i.c_str());
+ }
BOOST_FOREACH (string i, _cc) {
recipients = curl_slist_append (recipients, i.c_str());
}
@@ -251,7 +254,7 @@ Emailer::send (shared_ptr<Job> job)
CURLMcode mc = curl_multi_fdset (mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
if (mc != CURLM_OK) {
- throw KDMError (String::compose ("Failed to send KDM email to %1", _to));
+ throw KDMError (String::compose ("Failed to send KDM email to %1", address_list (_to)));
}
int rc;