From 2818f8e9ed5e8853e33636ac8efe09e2a4161618 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 6 Jul 2009 09:13:10 +0000 Subject: - Show SMTP errors in browser (#1485927) --- program/steps/mail/func.inc | 8 ++++---- program/steps/mail/sendmail.inc | 7 +++++-- program/steps/mail/sendmdn.inc | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index e7eb4b373..a942c1a44 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1302,7 +1302,7 @@ function rcmail_compose_cleanup() /** * Send the given message compose object using the configured method */ -function rcmail_deliver_message(&$message, $from, $mailto) +function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error) { global $CONFIG, $RCMAIL; @@ -1327,7 +1327,7 @@ function rcmail_deliver_message(&$message, $from, $mailto) // send message $smtp_response = array(); - $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers, true)), $msg_body, $smtp_response); + $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers, true)), $msg_body, $smtp_response, $smtp_error); // log error if (!$sent) @@ -1380,7 +1380,7 @@ function rcmail_deliver_message(&$message, $from, $mailto) } -function rcmail_send_mdn($uid) +function rcmail_send_mdn($uid, &$smtp_error) { global $RCMAIL, $IMAP; @@ -1438,7 +1438,7 @@ function rcmail_send_mdn($uid) $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n")); $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline'); - $sent = rcmail_deliver_message($compose, $identity['email'], $mailto); + $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error); if ($sent) { diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index d550a422d..c5a2ea7c3 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -441,12 +441,15 @@ if (!$savedraft) $OUTPUT->send('iframe'); } - $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto); + $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, $smtp_error); // return to compose page if sending failed if (!$sent) { - $OUTPUT->show_message("sendingfailed", 'error'); + if ($smtp_error) + $OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']); + else + $OUTPUT->show_message('sendingfailed', 'error'); $OUTPUT->send('iframe'); } diff --git a/program/steps/mail/sendmdn.inc b/program/steps/mail/sendmdn.inc index 3d7755cf3..c3294e7fe 100644 --- a/program/steps/mail/sendmdn.inc +++ b/program/steps/mail/sendmdn.inc @@ -21,7 +21,7 @@ if (!empty($_POST['_uid'])) { - $sent = rcmail_send_mdn(get_input_value('_uid', RCUBE_INPUT_POST)); + $sent = rcmail_send_mdn(get_input_value('_uid', RCUBE_INPUT_POST), $smtp_error); } // show either confirm or error message @@ -29,6 +29,9 @@ if ($sent) { $OUTPUT->set_env('mdn_request', false); $OUTPUT->show_message('receiptsent', 'confirmation'); } +else if ($smtp_error) { + $OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']); +} else { $OUTPUT->show_message('errorsendingreceipt', 'error'); } -- cgit v1.2.3