diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-10-07 17:10:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-10-09 13:44:57 +0100 |
| commit | 590975c2020fea67b06d82af5bec1b798d42ba9b (patch) | |
| tree | dbd0c795eaf491d055677d47de4a1eb44948acd8 /src/lib | |
| parent | 76196d4356ca5d92047e46ce8d617c688ad88c91 (diff) | |
Better error if no mail server has been configured.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cinema_kdms.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc index d7190b54d..966955ab4 100644 --- a/src/lib/cinema_kdms.cc +++ b/src/lib/cinema_kdms.cc @@ -28,6 +28,8 @@ #include <zip.h> #include <boost/foreach.hpp> +#include "i18n.h" + using std::list; using std::string; using boost::shared_ptr; @@ -162,7 +164,7 @@ CinemaKDMs::email (string filename_first_part, string cpl_name, list<CinemaKDMs> quickmail_set_body (mail, body.c_str()); quickmail_add_attachment_file (mail, zip_file.string().c_str(), "application/zip"); - char const* error = quickmail_send ( + char const* e = quickmail_send ( mail, Config::instance()->mail_server().c_str(), Config::instance()->mail_port(), @@ -170,12 +172,19 @@ CinemaKDMs::email (string filename_first_part, string cpl_name, list<CinemaKDMs> Config::instance()->mail_password().c_str() ); - if (error) { + if (e) { quickmail_destroy (mail); + + string error (e); + + if (Config::instance()->mail_server().empty ()) { + error = _("no mail server set up in preferences"); + } + throw KDMError ( String::compose ( - "Failed to send KDM email to %1 (%2)", - Config::instance()->mail_server(), + _("Failed to send KDM email to %1 (%2)"), + i.cinema->email, error ) ); |
