This commit is contained in:
Stevehans 2026-01-09 18:35:15 +00:00 committed by GitHub
commit 57e23954b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -275,6 +275,12 @@ class SMTP
*/
protected $last_reply = '';
/**
* Whether we are in the DATA phase or not
* @var bool
*/
private $inData = false;
/**
* Output debugging info via a user-selected method.
*
@ -806,9 +812,12 @@ class SMTP
{
//This will use the standard timelimit
if (!$this->sendCommand('DATA', 'DATA', 354)) {
$this->inData = false;
return false;
}
$this->inData = true;
/* The server is ready to accept data!
* According to rfc821 we should not send more than 1000 characters on a single line (including the LE)
* so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
@ -881,6 +890,7 @@ class SMTP
$this->recordLastTransactionID();
//Restore timelimit
$this->Timelimit = $savetimelimit;
$this->inData = false;
return $result;
}
@ -1020,7 +1030,11 @@ class SMTP
*/
public function quit($close_on_error = true)
{
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
if ($this->inData) {
$noerror = true;
} else {
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
}
$err = $this->error; //Save any error
if ($noerror || $close_on_error) {
$this->close();