diff --git a/test/TlsIconTest.php b/test/TlsIconTest.php
index 3cbc732..792a4b9 100644
--- a/test/TlsIconTest.php
+++ b/test/TlsIconTest.php
@@ -33,6 +33,9 @@ final class TlsIconTest extends TestCase
/** @var string */
private $strStalwartCryptedTlsv13WithCipher = '
';
+ /** @var string */
+ private $strNewPostfixTLSv13 = '
';
+
public function testInstance()
{
$o = new tls_icon();
@@ -196,6 +199,43 @@ public function testMessageHeadersInternal()
], $headersProcessed);
}
+ public function testPostfixTLS13NewSyntax()
+ {
+ $header = 'from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11023139.outbound.protection.outlook.com [52.101.83.139])
+ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (4096 bits) server-digest SHA256)
+ (No client certificate requested)
+ by example.com with ESMTPS id EXAMPLE
+ for ; Tue, 16 Sep 2025 12:26:17 +0200 (CEST)';
+
+ $o = new tls_icon();
+ $headersProcessed = $o->message_headers([
+ 'output' => [
+ 'subject' => [
+ 'value' => 'Sent to you',
+ ],
+ ],
+ 'headers' => (object)[
+ 'others' => [
+ 'received' => $header,
+ ]
+ ]
+ ]);
+ $this->assertEquals([
+ 'output' => [
+ 'subject' => [
+ 'value' => 'Sent to you' . $this->strNewPostfixTLSv13,
+ 'html' => 1,
+ ],
+ ],
+ 'headers' => (object)[
+ 'others' => [
+ 'received' => $header,
+ ]
+ ]
+ ], $headersProcessed);
+ }
+
+
public function testMessageHeadersMultiFromWithConfig()
{
$inputHeaders = [
diff --git a/tls_icon.php b/tls_icon.php
index 40a4b6f..3984f4b 100644
--- a/tls_icon.php
+++ b/tls_icon.php
@@ -2,7 +2,7 @@
class tls_icon extends rcube_plugin
{
- const POSTFIX_TLS_REGEX = "/\(using (TLS[^()]+(?:\([^)]+\))?)\)/im";
+ const POSTFIX_TLS_REGEX = "/\(using (TLS(?:[^()]|\([^()]*\))*)\)/im";
const POSTFIX_LOCAL_REGEX = "/\([a-zA-Z]*, from userid [0-9]*\)/im";
const SENDMAIL_TLS_REGEX = "/\(version=(TLS.*)\)(\s+for|;)/im";
@@ -59,8 +59,10 @@ public function message_headers($p)
return $p;
}
- if (preg_match_all(tls_icon::POSTFIX_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER) ||
- preg_match_all(tls_icon::SENDMAIL_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER)) {
+ if (
+ preg_match_all(tls_icon::POSTFIX_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER) ||
+ preg_match_all(tls_icon::SENDMAIL_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER)
+ ) {
$data = $items[1][0];
$this->icon_img .= '
';
} elseif (preg_match_all(tls_icon::POSTFIX_LOCAL_REGEX, $Received, $items, PREG_PATTERN_ORDER)) {