X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fsend_notification_email_job.cc;h=2dd1f63f269f7558af4b40523c66331a257cf786;hp=1c9d963388a1eefd1451984481f4b05f1df5484b;hb=9f125fddff88bf62d36381f9d3f09e5240b033d5;hpb=caf67bef2611a911307267b20dbf3be89ffff71f diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index 1c9d96338..2dd1f63f2 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,19 +18,19 @@ */ + #include "send_notification_email_job.h" #include "exceptions.h" #include "config.h" #include "emailer.h" #include "compose.hpp" -#include -#include #include "i18n.h" + using std::string; -using std::list; -using boost::shared_ptr; +using std::shared_ptr; + /** @param body Email body */ SendNotificationEmailJob::SendNotificationEmailJob (string body) @@ -40,41 +40,43 @@ SendNotificationEmailJob::SendNotificationEmailJob (string body) } + SendNotificationEmailJob::~SendNotificationEmailJob () { stop_thread (); } + string SendNotificationEmailJob::name () const { return _("Email notification"); } + string SendNotificationEmailJob::json_name () const { return N_("send_notification_email"); } + void SendNotificationEmailJob::run () { - Config* config = Config::instance (); + auto config = Config::instance (); if (config->mail_server().empty()) { throw NetworkError (_("No mail server configured in preferences")); } set_progress_unknown (); - list to; - to.push_back (config->notification_to ()); - Emailer email (config->notification_from(), to, config->notification_subject(), _body); - BOOST_FOREACH (string i, config->notification_cc()) { + Emailer email (config->notification_from(), { config->notification_to() }, config->notification_subject(), _body); + for (auto i: config->notification_cc()) { email.add_cc (i); } if (!config->notification_bcc().empty()) { - email.add_bcc (config->notification_bcc ()); + email.add_bcc (config->notification_bcc()); } email.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());