Skip to content

Commit

Permalink
Merge pull request #4621 from Xety/3.0-fix-mail-exception
Browse files Browse the repository at this point in the history
3.0 Fix mail Exception
  • Loading branch information
markstory committed Sep 16, 2014
2 parents 4255491 + 7dbfa90 commit 72a6dfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/Network/Email/MailTransport.php
Expand Up @@ -16,7 +16,7 @@
*/
namespace Cake\Network\Email;

use Cake\Network\Error;
use Cake\Network\Exception\SocketException;

/**
* Send mail using mail() function
Expand All @@ -29,7 +29,6 @@ class MailTransport extends AbstractTransport {
*
* @param \Cake\Network\Email\Email $email Cake Email
* @return array
* @throws \Cake\Network\Error\SocketException When mail cannot be sent.
*/
public function send(Email $email) {
$eol = PHP_EOL;
Expand Down Expand Up @@ -61,15 +60,15 @@ public function send(Email $email) {
* @param string $message email's body
* @param string $headers email's custom headers
* @param string $params additional params for sending email
* @throws \Cake\Network\Error\SocketException if mail could not be sent
* @throws \Cake\Network\Exception\SocketException if mail could not be sent
* @return void
*/
protected function _mail($to, $subject, $message, $headers, $params = null) {
//@codingStandardsIgnoreStart
if (!@mail($to, $subject, $message, $headers, $params)) {
$error = error_get_last();
$msg = 'Could not send email: ' . (isset($error['message']) ? $error['message'] : 'unknown');
throw new Error\SocketException($msg);
throw new SocketException($msg);
}
//@codingStandardsIgnoreEnd
}
Expand Down
1 change: 0 additions & 1 deletion src/Network/Email/SmtpTransport.php
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\Network\Email;

use Cake\Network\Error;
use Cake\Network\Socket;
use Cake\Network\Exception\SocketException;

Expand Down

0 comments on commit 72a6dfe

Please sign in to comment.