- auto dialog = new SendTestEmailDialog(_panel);
- auto result = dialog->ShowModal();
- dialog->Destroy();
- if (result == wxID_OK) {
- Emailer emailer(
- wx_to_std(dialog->from()),
- { wx_to_std(dialog->to()) },
- wx_to_std(_("DCP-o-matic test email")),
- wx_to_std(_("This is a test email from DCP-o-matic."))
- );
- auto config = Config::instance();
- try {
- emailer.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
- } catch (NetworkError& e) {
- error_dialog (_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or("")));
- return;
- } catch (std::exception& e) {
- error_dialog (_panel, _("Test email sending failed."), std_to_wx(e.what()));
- return;
- } catch (...) {
- error_dialog (_panel, _("Test email sending failed."));
- return;
- }
- message_dialog (_panel, _("Test email sent."));
+ SendTestEmailDialog dialog(_panel);
+ if (dialog.ShowModal() != wxID_OK) {
+ return;
+ }
+
+ Emailer emailer(
+ wx_to_std(dialog.from()),
+ { wx_to_std(dialog.to()) },
+ wx_to_std(_("DCP-o-matic test email")),
+ wx_to_std(_("This is a test email from DCP-o-matic."))
+ );
+ auto config = Config::instance();
+ try {
+ emailer.send(config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
+ } catch (NetworkError& e) {
+ error_dialog(_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or("")));
+ return;
+ } catch (std::exception& e) {
+ error_dialog(_panel, _("Test email sending failed."), std_to_wx(e.what()));
+ return;
+ } catch (...) {
+ error_dialog(_panel, _("Test email sending failed."));
+ return;