Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions test/TlsIconTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class TlsIconTest extends TestCase
/** @var string */
private $strSendmailCryptedTlsv12WithCipherVerify = '<img class="lock_icon" src="plugins/tls_icon/lock.svg" title="TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK" />';

/** @var string */
private $strStalwartCryptedTlsv13WithCipher = '<img class="lock_icon" src="plugins/tls_icon/lock.svg" title="TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384" />';

public function testInstance()
{
Expand Down Expand Up @@ -379,4 +381,40 @@ public function testSendmailTLS13MultipleRecipients()
]
], $headersProcessed);
}

public function testStalwartTls()
{
$o = new tls_icon();
$headersProcessed = $o->message_headers([
'output' => [
'subject' => [
'value' => 'Sent to you',
],
],
'headers' => (object) [
'others' => [
'received' => 'from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174] (AS15169 Google LLC, US))
(using TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384)
by mail.example.org (Stalwart SMTP) with ESMTPS id 36DAF29F3A02098;
Mon, 16 Jun 2025 13:33:03 +0000',
]
]
]);
$this->assertEquals([
'output' => [
'subject' => [
'value' => 'Sent to you' . $this->strStalwartCryptedTlsv13WithCipher,
'html' => 1,
],
],
'headers' => (object) [
'others' => [
'received' => 'from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174] (AS15169 Google LLC, US))
(using TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384)
by mail.example.org (Stalwart SMTP) with ESMTPS id 36DAF29F3A02098;
Mon, 16 Jun 2025 13:33:03 +0000',
]
]
], $headersProcessed);
}
}
2 changes: 1 addition & 1 deletion tls_icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class tls_icon extends rcube_plugin
{
const POSTFIX_TLS_REGEX = "/\(using (TLS.*)\) \(/im";
const POSTFIX_TLS_REGEX = "/\(using (TLS[^()]+(?:\([^)]+\))?)/im";
Comment thread
GermanCoding marked this conversation as resolved.
Outdated
const POSTFIX_LOCAL_REGEX = "/\([a-zA-Z]*, from userid [0-9]*\)/im";
const SENDMAIL_TLS_REGEX = "/\(version=(TLS.*)\)(\s+for|;)/im";

Expand Down