Permalink
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...
1 parent 2484179 commit 4dc656fd9116229ef4f0431077c274d3be7b3ff0 @jperras jperras committed Sep 6, 2009
@@ -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')) {
@@ -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

0 comments on commit 4dc656f

Please sign in to comment.