Fix nonfunctional send-problem-report.
authorCarl Hetherington <cth@carlh.net>
Fri, 4 Dec 2015 02:14:07 +0000 (02:14 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 4 Dec 2015 02:14:07 +0000 (02:14 +0000)
ChangeLog
src/lib/cinema_kdms.cc
src/lib/emailer.cc
src/lib/emailer.h
src/lib/send_problem_report_job.cc

index bea02a8b737c2975e49c8aee5eb53bc4268a9d2c..7aee3f56107959c82fd9d164dcd9d62c411639da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-12-04  Carl Hetherington  <cth@carlh.net>
+
+       * Fix non-functional send-problem-report.
+
 2015-12-03  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.6.2 released.
index d95e0285425059afae27a7f344cc4170b7e6db00..2b1d457aa1ad04614fa7d378207b1fde1584c38f 100644 (file)
@@ -163,7 +163,9 @@ CinemaKDMs::email (
 
                string const name = tidy_for_filename(i.cinema->name) + "_" + tidy_for_filename(film_name) + ".zip";
                email.add_attachment (zip_file, name, "application/zip");
-               email.send ();
+
+               Config* c = Config::instance ();
+               email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password());
 
                if (log) {
                        log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
index c20cc897d4260cb8647b4b8b15a3756904347e19..c7f1b9053fc2f8bc2c6298620488a2491dd47ea7 100644 (file)
@@ -90,7 +90,7 @@ Emailer::get_data (void* ptr, size_t size, size_t nmemb)
 }
 
 void
-Emailer::send ()
+Emailer::send (string server, int port, string user, string password)
 {
        char date_buffer[32];
        time_t now = time (0);
@@ -172,17 +172,13 @@ Emailer::send ()
                throw NetworkError ("Could not initialise libcurl");
        }
 
-       curl_easy_setopt (curl, CURLOPT_URL, String::compose (
-                                 "smtp://%1:%2",
-                                 Config::instance()->mail_server().c_str(),
-                                 Config::instance()->mail_port()
-                                 ).c_str());
+       curl_easy_setopt (curl, CURLOPT_URL, String::compose ("smtp://%1:%2", server.c_str(), port).c_str());
 
-       if (!Config::instance()->mail_user().empty ()) {
-               curl_easy_setopt (curl, CURLOPT_USERNAME, Config::instance()->mail_user().c_str());
+       if (!user.empty ()) {
+               curl_easy_setopt (curl, CURLOPT_USERNAME, user.c_str ());
        }
-       if (!Config::instance()->mail_password().empty ()) {
-               curl_easy_setopt (curl, CURLOPT_PASSWORD, Config::instance()->mail_password().c_str());
+       if (!password.empty ()) {
+               curl_easy_setopt (curl, CURLOPT_PASSWORD, password.c_str());
        }
 
        curl_easy_setopt (curl, CURLOPT_MAIL_FROM, _from.c_str());
index 8ec983f4368511e04d1cbfded031e3c6cddf380a..9d799c81ce639a68b68d8e88b4fa370744fa852b 100644 (file)
@@ -29,7 +29,7 @@ public:
        void add_bcc (std::string bcc);
        void add_attachment (boost::filesystem::path file, std::string name, std::string mime_type);
 
-       void send ();
+       void send (std::string server, int port, std::string user = "", std::string password = "");
 
        std::string notes () const {
                return _notes;
index 803e655a6ee8a7bfd89873c1fddc49946b12bdbc..139bdb81c7279580ce6f9860a9d0860eaac26a32 100644 (file)
@@ -85,7 +85,7 @@ SendProblemReportJob::run ()
        to.push_back ("carl@dcpomatic.com");
 
        Emailer emailer (_from, to, "DCP-o-matic problem report", body);
-       emailer.send ();
+       emailer.send ("main.carlh.net", 2525);
 
        set_progress (1);
        set_state (FINISHED_OK);