Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating EmailComponent smtp HELO handling to account for non-existen…

…ce of HTTP_HOST environment variable when PHP SAPI is CLI. Fixes #41.
  • Loading branch information...
commit 4dc656fd9116229ef4f0431077c274d3be7b3ff0 1 parent 2484179
Joel Perras jperras authored
6 cake/libs/controller/components/email.php
View
@@ -680,10 +680,14 @@ function __smtp() {
return false;
}
+ $httpHost = env('HTTP_HOST');
+
if (isset($this->smtpOptions['client'])) {
$host = $this->smtpOptions['client'];
+ } elseif (!empty($httpHost)) {
+ $host = $httpHost;
} else {
- $host = env('HTTP_HOST');
+ $host = 'localhost';
}
if (!$this->__smtpSend("HELO {$host}", '250')) {
3  cake/tests/cases/libs/controller/components/email.test.php
View
@@ -478,10 +478,9 @@ function testSmtpSendSocket() {
$response = $this->Controller->EmailTest->smtpSend('HELO', '250');
$this->assertPattern('/501 Syntax: HELO hostname/', $this->Controller->EmailTest->smtpError);
- $this->Controller->EmailTest->smtpError = null;
+ $this->Controller->EmailTest->reset();
$response = $this->Controller->EmailTest->smtpSend('HELO somehostname', '250');
$this->assertNoPattern('/501 Syntax: HELO hostname/', $this->Controller->EmailTest->smtpError);
-
}
/**
* testSendDebug method
Please sign in to comment.
Something went wrong with that request. Please try again.