diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-10-07 23:31:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-10-09 13:45:00 +0100 |
| commit | 2852855f19fadb6d7e43282e545a0bcaedc1a3f7 (patch) | |
| tree | 91618c9da669ad68733e8b12c8fcf555a3e848c3 /src/lib/emailer.cc | |
| parent | fa8bdd16e1b3742e921b928708614613b6a21036 (diff) | |
Tweak naming of KDM emails and attachments.
Diffstat (limited to 'src/lib/emailer.cc')
| -rw-r--r-- | src/lib/emailer.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/emailer.cc b/src/lib/emailer.cc index 0febb56ab..0193f3605 100644 --- a/src/lib/emailer.cc +++ b/src/lib/emailer.cc @@ -61,9 +61,13 @@ Emailer::add_bcc (string bcc) } void -Emailer::add_attachment (boost::filesystem::path attachment, string mime_type) +Emailer::add_attachment (boost::filesystem::path file, string name, string mime_type) { - _attachments.push_back (make_pair (attachment, mime_type)); + Attachment a; + a.file = file; + a.name = name; + a.mime_type = mime_type; + _attachments.push_back (a); } static size_t @@ -129,18 +133,18 @@ Emailer::send (shared_ptr<Job> job) email << _body; - for (list<pair<boost::filesystem::path, string> >::const_iterator i = _attachments.begin(); i != _attachments.end(); ++i) { + BOOST_FOREACH (Attachment i, _attachments) { email << "\r\n\r\n--" << boundary << "\r\n" - << "Content-Type: " << i->second << "; name=" << i->first.leaf() << "\r\n" + << "Content-Type: " << i.mime_type << "; name=" << i.name << "\r\n" << "Content-Transfer-Encoding: Base64\r\n" - << "Content-Disposition: attachment; filename=" << i->first.leaf() << "\r\n\r\n"; + << "Content-Disposition: attachment; filename=" << i.name << "\r\n\r\n"; BIO* b64 = BIO_new (BIO_f_base64()); BIO* bio = BIO_new (BIO_s_mem()); bio = BIO_push (b64, bio); - Data data (i->first); + Data data (i.file); BIO_write (bio, data.data().get(), data.size()); (void) BIO_flush (bio); |
