From 56ed2f3ab3714f8e5bf076920a0c52d8b2614984 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 29 Aug 2017 14:37:27 +0200 Subject: [PATCH] E-Mail: Versandfehler oben auch anzeigen --- SL/Form.pm | 7 ++++++- SL/Mailer.pm | 4 ++-- locale/de/all | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index f29c60128..fa2a83542 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1199,7 +1199,12 @@ sub send_email { $mail->{message} =~ s/\r//g; $mail->{message} .= $full_signature; $self->{emailerr} = $mail->send(); - # $self->error($self->cleanup . "$err") if $self->{emailerr}; + + if ($self->{emailerr}) { + $self->cleanup; + $self->error($::locale->text('The email was not sent due to the following error: #1.', $self->{emailerr})); + } + $self->{email_journal_id} = $mail->{journalentry}; $self->{snumbers} = "emailjournal" . "_" . $self->{email_journal_id}; $self->{what_done} = $::form->{type}; diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 52a7d7469..87b3dfc86 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -225,7 +225,7 @@ sub send { $self->_store_in_journal('failed', 'driver could not be created; check your configuration & log files'); $::lxdebug->message(LXDebug::WARN(), "Mailer error during 'send': $error"); - return "send email : $error"; + return $error; } # Set defaults & headers @@ -264,7 +264,7 @@ sub send { $self->{journalentry} = $self->_store_in_journal; - return $ok ? '' : "send email: $error"; + return $ok ? '' : ($error || "undefined error"); } sub _all_recipients { diff --git a/locale/de/all b/locale/de/all index 6a050b52f..5f7b74267 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3014,6 +3014,7 @@ $self->{texts} = { 'The documents have been sent to the printer \'#1\'.' => 'Die Dokumente sind zum Drucker \'#1\' geschickt', 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', 'The email has been sent.' => 'Die E-Mail wurde verschickt.', + 'The email was not sent due to the following error: #1.' => 'Die E-Mail wurde aufgrund des folgenden Fehlers nicht verschickt: #1', 'The employee is missing.' => 'Der Bearbeiter fehlt.', 'The end date is the last day for which invoices will possibly be created.' => 'Das Enddatum ist das letztmögliche Datum, an dem eine Rechnung erzeugt wird.', 'The execution schedule is invalid.' => 'Der Ausführungszeitplan ist ungültig.', -- 2.20.1