summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-01-28 09:39:23 +0100
committerAleksander Machniak <alec@alec.pl>2015-01-28 09:39:23 +0100
commita3fa844aad10a63e2cca8ff533f75713cba0dcbe (patch)
tree4955b1dda68ff901db6a27484c2bff8f8c587366 /program/lib/Roundcube
parent3b46c965d768c36960709f075c52725afefa7a65 (diff)
Make logged SMTP errors more verbose - log also real server response and codes
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r--program/lib/Roundcube/rcube.php2
-rw-r--r--program/lib/Roundcube/rcube_smtp.php14
2 files changed, 9 insertions, 7 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 547e2b4ac..819c7f848 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1706,7 +1706,7 @@ class rcube
if (!$sent) {
self::raise_error(array('code' => 800, 'type' => 'smtp',
'line' => __LINE__, 'file' => __FILE__,
- 'message' => "SMTP error: ".join("\n", $response)), TRUE, FALSE);
+ 'message' => join("\n", $response)), true, false);
}
}
// send mail using PHP's mail() function
diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php
index 70f15dc7b..c3a51467b 100644
--- a/program/lib/Roundcube/rcube_smtp.php
+++ b/program/lib/Roundcube/rcube_smtp.php
@@ -243,8 +243,9 @@ class rcube_smtp
if (PEAR::isError($this->conn->mailFrom($from, $from_params))) {
$err = $this->conn->getResponse();
$this->error = array('label' => 'smtpfromerror', 'vars' => array(
- 'from' => $from, 'code' => $this->conn->_code, 'msg' => $err[1]));
- $this->response[] = "Failed to set sender '$from'";
+ 'from' => $from, 'code' => $err[0], 'msg' => $err[1]));
+ $this->response[] = "Failed to set sender '$from'. "
+ . $err[1] . ' (Code: ' . $err[0] . ')';
$this->reset();
return false;
}
@@ -262,8 +263,9 @@ class rcube_smtp
if (PEAR::isError($this->conn->rcptTo($recipient, $recipient_params))) {
$err = $this->conn->getResponse();
$this->error = array('label' => 'smtptoerror', 'vars' => array(
- 'to' => $recipient, 'code' => $this->conn->_code, 'msg' => $err[1]));
- $this->response[] = "Failed to add recipient '$recipient'";
+ 'to' => $recipient, 'code' => $err[0], 'msg' => $err[1]));
+ $this->response[] = "Failed to add recipient '$recipient'. "
+ . $err[1] . ' (Code: ' . $err[0] . ')';
$this->reset();
return false;
}
@@ -286,7 +288,7 @@ class rcube_smtp
}
// Send the message's headers and the body as SMTP data.
- if (PEAR::isError($result = $this->conn->data($data, $text_headers))) {
+ if (PEAR::isError($this->conn->data($data, $text_headers))) {
$err = $this->conn->getResponse();
if (!in_array($err[0], array(354, 250, 221))) {
$msg = sprintf('[%d] %s', $err[0], $err[1]);
@@ -296,7 +298,7 @@ class rcube_smtp
}
$this->error = array('label' => 'smtperror', 'vars' => array('msg' => $msg));
- $this->response[] = "Failed to send data";
+ $this->response[] = "Failed to send data. " . $msg;
$this->reset();
return false;
}