From 40e2375b3e2295bb091ded78e37d50137d4edf4f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 17 Oct 2022 15:43:45 +0200 Subject: [PATCH] Draft code for BIMI (not active due to being slow) https://github.com/the-djmaze/snappymail/issues/115#issuecomment-1186485370 --- .../v/0.0.0/app/libraries/MailSo/Mime/Email.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php index 5a74ab8a0..2a117ad62 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php @@ -257,12 +257,26 @@ class Email implements \JsonSerializable #[\ReturnTypeWillChange] public function jsonSerialize() { +/* + $BIMI = ''; + if (Enumerations\DkimStatus::PASS == $this->GetDkimStatus()) { + if ($values = \dns_get_record($this->GetDomain(), \DNS_TXT)) { + foreach ($values as $value) { + if (\str_starts_with($value['txt'], 'v=BIMI1')) { + $BIMI = \preg_replace('/^.+l=([^;]+)(;.*)?$/', '$1', $value['txt']); + break; + } + } + } + } +*/ return array( '@Object' => 'Object/Email', 'Name' => \MailSo\Base\Utils::Utf8Clear($this->GetDisplayName()), 'Email' => \MailSo\Base\Utils::Utf8Clear($this->GetEmail(true)), 'DkimStatus' => $this->GetDkimStatus(), - 'DkimValue' => $this->GetDkimValue() + 'DkimValue' => $this->GetDkimValue(), + 'BIMI' => $BIMI ); } }