Improved contact form and responsive aspect
This commit is contained in:
1 parent
216077cd32
commit
98d513acb7
19 files changed
+584
-733
No files matched your search
@@ -34,9 +34,8 @@ class SMTP
|
||||
* The PHPMailer SMTP version number.
|
||||
*
|
||||
* @var string
|
||||
* @deprecated This constant will be removed in PHPMailer 8.0. Use `PHPMailer::VERSION` instead.
|
||||
*/
|
||||
const VERSION = '7.1.1';
|
||||
const VERSION = '6.10.0';
|
||||
|
||||
/**
|
||||
* SMTP line break constant.
|
||||
@@ -206,7 +205,6 @@ class SMTP
|
||||
'Haraka' => '/[\d]{3} Message Queued \((.*)\)/',
|
||||
'ZoneMTA' => '/[\d]{3} Message queued as (.*)/',
|
||||
'Mailjet' => '/[\d]{3} OK queued as (.*)/',
|
||||
'Gsmtp' => '/[\d]{3} 2\.0\.0 OK (.*) - gsmtp/',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -275,14 +273,6 @@ class SMTP
|
||||
*/
|
||||
protected $last_reply = '';
|
||||
|
||||
/**
|
||||
* The last command sent to the server.
|
||||
* Used to avoid sending QUIT while a DATA command is still in progress.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $state = '';
|
||||
|
||||
/**
|
||||
* Output debugging info via a user-selected method.
|
||||
*
|
||||
@@ -503,9 +493,7 @@ class SMTP
|
||||
//PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT
|
||||
//so add them back in manually if we can
|
||||
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
|
||||
// phpcs:ignore PHPCompatibility.Constants.NewConstants.stream_crypto_method_tlsv1_2_clientFound
|
||||
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||
// phpcs:ignore PHPCompatibility.Constants.NewConstants.stream_crypto_method_tlsv1_1_clientFound
|
||||
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
||||
}
|
||||
|
||||
@@ -644,49 +632,11 @@ class SMTP
|
||||
if (null === $OAuth) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$oauth = $OAuth->getOauth64();
|
||||
} catch (\Exception $e) {
|
||||
// We catch all exceptions and convert them to PHPMailer exceptions to be able to
|
||||
// handle them correctly later
|
||||
throw new Exception("SMTP authentication error", 0, $e);
|
||||
}
|
||||
/*
|
||||
* An SMTP command line can have a maximum length of 512 bytes, including the command name,
|
||||
* so the base64-encoded OAUTH token has a maximum length of:
|
||||
* 512 - 13 (AUTH XOAUTH2) - 2 (CRLF) = 497 bytes
|
||||
* If the token is longer than that, the command and the token must be sent separately as described in
|
||||
* https://www.rfc-editor.org/rfc/rfc4954#section-4
|
||||
*/
|
||||
if ($oauth === '') {
|
||||
//Sending an empty auth token is legitimate, but it must be encoded as '='
|
||||
//to indicate it's not a 2-part command
|
||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 =', 235)) {
|
||||
return false;
|
||||
}
|
||||
} elseif (strlen($oauth) <= 497) {
|
||||
//Authenticate using a token in the initial-response part
|
||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
//The token is too long, so we need to send it in two parts.
|
||||
//Send the auth command without a token and expect a 334
|
||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2', 334)) {
|
||||
return false;
|
||||
}
|
||||
//Send the token
|
||||
if (!$this->sendCommand('OAuth TOKEN', $oauth, [235, 334])) {
|
||||
return false;
|
||||
}
|
||||
//If the server answers with 334, send an empty line
|
||||
//a reply other than a 235 means the authentication failed, so we don't need to send anything else
|
||||
if (
|
||||
strpos($this->last_reply, '334') === 0
|
||||
&& !$this->sendCommand('AUTH End', '', 235)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
$oauth = $OAuth->getOauth64();
|
||||
|
||||
//Start authentication
|
||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -771,7 +721,6 @@ class SMTP
|
||||
{
|
||||
$this->server_caps = null;
|
||||
$this->helo_rply = null;
|
||||
$this->state = '';
|
||||
if (is_resource($this->smtp_conn)) {
|
||||
//Close the connection and cleanup
|
||||
fclose($this->smtp_conn);
|
||||
@@ -780,25 +729,6 @@ class SMTP
|
||||
}
|
||||
}
|
||||
|
||||
private function iterateLines($s)
|
||||
{
|
||||
$start = 0;
|
||||
$length = strlen($s);
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$c = $s[$i];
|
||||
if ($c === "\n" || $c === "\r") {
|
||||
yield substr($s, $start, $i - $start);
|
||||
if ($c === "\r" && $i + 1 < $length && $s[$i + 1] === "\n") {
|
||||
$i++;
|
||||
}
|
||||
$start = $i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
yield substr($s, $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an SMTP DATA command.
|
||||
* Issues a data command and sends the msg_data to the server,
|
||||
@@ -827,16 +757,15 @@ class SMTP
|
||||
* NOTE: this does not count towards line-length limit.
|
||||
*/
|
||||
|
||||
//Iterate over lines with normalized line breaks
|
||||
$lines = $this->iterateLines($msg_data);
|
||||
//Normalize line breaks before exploding
|
||||
$lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
|
||||
|
||||
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
|
||||
* of the first line (':' separated) does not contain a space then it _should_ be a header, and we will
|
||||
* process all lines before a blank line as headers.
|
||||
*/
|
||||
|
||||
$first_line = $lines->current();
|
||||
$field = substr($first_line, 0, strpos($first_line, ':'));
|
||||
$field = substr($lines[0], 0, strpos($lines[0], ':'));
|
||||
$in_headers = false;
|
||||
if (!empty($field) && strpos($field, ' ') === false) {
|
||||
$in_headers = true;
|
||||
@@ -1030,12 +959,7 @@ class SMTP
|
||||
*/
|
||||
public function quit($close_on_error = true)
|
||||
{
|
||||
if ($this->state === 'DATA') {
|
||||
//The server would take QUIT as part of an unfinished message, so just close the connection
|
||||
$noerror = true;
|
||||
} else {
|
||||
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
|
||||
}
|
||||
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
|
||||
$err = $this->error; //Save any error
|
||||
if ($noerror || $close_on_error) {
|
||||
$this->close();
|
||||
@@ -1138,7 +1062,6 @@ class SMTP
|
||||
|
||||
return false;
|
||||
}
|
||||
$this->state = $command;
|
||||
$this->client_send($commandstring . static::LE, $command);
|
||||
|
||||
$this->last_reply = $this->get_lines();
|
||||
@@ -1305,7 +1228,7 @@ class SMTP
|
||||
* 3. EHLO has been sent -
|
||||
* $name == 'HELO'|'EHLO': returns the server name
|
||||
* $name == any other string: if extension $name exists, returns True
|
||||
* or its options (e.g. AUTH mechanisms supported). Otherwise, returns False.
|
||||
* or its options (e.g. AUTH mechanisms supported). Otherwise returns False.
|
||||
*
|
||||
* @param string $name Name of SMTP extension or 'HELO'|'EHLO'
|
||||
*
|
||||
@@ -1386,16 +1309,7 @@ class SMTP
|
||||
|
||||
//stream_select returns false when the `select` system call is interrupted
|
||||
//by an incoming signal, try the select again
|
||||
if (
|
||||
stripos($message, 'interrupted system call') !== false ||
|
||||
(
|
||||
// on applications with a different locale than english, the message above is not found because
|
||||
// it's translated. So we also check for the SOCKET_EINTR constant which is defined under
|
||||
// Windows and UNIX-like platforms (if available on the platform).
|
||||
defined('SOCKET_EINTR') &&
|
||||
stripos($message, 'stream_select(): Unable to select [' . SOCKET_EINTR . ']') !== false
|
||||
)
|
||||
) {
|
||||
if (stripos($message, 'interrupted system call') !== false) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): retrying stream_select',
|
||||
self::DEBUG_LOWLEVEL
|
||||
|
||||
Reference in new issue
Block a user