From a45c4ac7032ac5c435105190b6fa947879c0610a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 8 Apr 2016 23:49:26 +0100 Subject: [PATCH] Log full email body to DEBUG_EMAIL. --- src/lib/cinema_kdms.cc | 6 ++++++ src/lib/emailer.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc index d7495e9ac..318eebe39 100644 --- a/src/lib/cinema_kdms.cc +++ b/src/lib/cinema_kdms.cc @@ -174,12 +174,18 @@ CinemaKDMs::email ( email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password()); } catch (...) { if (log) { + log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL); + log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL); + log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL); log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL); } throw; } if (log) { + log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL); + log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL); + log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL); log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL); } } diff --git a/src/lib/emailer.h b/src/lib/emailer.h index 9d799c81c..5924e79b1 100644 --- a/src/lib/emailer.h +++ b/src/lib/emailer.h @@ -38,6 +38,11 @@ public: size_t get_data (void* ptr, size_t size, size_t nmemb); int debug (CURL* curl, curl_infotype type, char* data, size_t size); + /** @return full email, after send() has been called */ + std::string email () const { + return _email; + } + static std::string address_list (std::list addresses); private: -- 2.30.2