Display value of the SMTP message size limit in the error message (#6032)

pull/5874/merge
Aleksander Machniak 7 years ago
parent adc9df803b
commit eed4be3ba6

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Display value of the SMTP message size limit in the error message (#6032)
- Skip redundant INSERT query on successful logon when using PHP7
- Replace display_version with display_product_version (#5904)
- Extend disabled_actions config so it accepts also button names (#5903)

@ -300,15 +300,37 @@ class rcube_smtp
// Send the message's headers and the body as SMTP data.
$result = $this->conn->data($data, $text_headers);
if (is_a($result, 'PEAR_Error')) {
$err = $this->conn->getResponse();
$err = $this->conn->getResponse();
$err_label = 'smtperror';
$err_vars = array();
if (!in_array($err[0], array(354, 250, 221))) {
$msg = sprintf('[%d] %s', $err[0], $err[1]);
}
else {
$msg = $result->getMessage();
if (strpos($msg, 'size exceeds')) {
$err_label = 'smtpsizeerror';
$exts = $this->conn->getServiceExtensions();
$limit = $exts['SIZE'];
if ($limit) {
$msg .= " (Limit: $limit)";
$rcube = rcube::get_instance();
if (method_exists($rcube, 'show_bytes')) {
$limit = $rcube->show_bytes($limit);
}
$err_vars['limit'] = $limit;
$err_label = 'smtpsizeerror';
}
}
}
$this->error = array('label' => 'smtperror', 'vars' => array('msg' => $msg));
$err_vars['msg'] = $msg;
$this->error = array('label' => $err_label, 'vars' => $err_vars);
$this->response[] = "Failed to send data. " . $msg;
$this->reset();
return false;

@ -164,6 +164,7 @@ $messages['smtpautherror'] = 'SMTP Error ($code): Authentication failed.';
$messages['smtpfromerror'] = 'SMTP Error ($code): Failed to set sender "$from" ($msg).';
$messages['smtptoerror'] = 'SMTP Error ($code): Failed to add recipient "$to" ($msg).';
$messages['smtprecipientserror'] = 'SMTP Error: Unable to parse recipients list.';
$messages['smtpsizeerror'] = 'SMTP Error: Message size exceeds server limit ($limit)';
$messages['smtperror'] = 'SMTP Error: $msg';
$messages['emailformaterror'] = 'Invalid email address: $email';
$messages['toomanyrecipients'] = 'Too many recipients. Reduce the number of recipients to $max.';

Loading…
Cancel
Save