Updating EmailComponent smtp HELO handling to account for non-existence of HTTP_HOST environment variable when PHP SAPI is CLI. Fixes #41.

This commit is contained in:
jperras 2009-09-06 19:49:50 -04:00
parent 2484179e36
commit 4dc656fd91
2 changed files with 6 additions and 3 deletions

View file

@ -680,10 +680,14 @@ class EmailComponent extends Object{
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')) {

View file

@ -478,10 +478,9 @@ TEXTBLOC;
$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