mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
2484179e36
commit
4dc656fd91
2 changed files with 6 additions and 3 deletions
|
@ -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')) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue