From c8d6281b3e4beb8079081d6a6927fcdaab354c2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Sep 2024 11:16:52 +0200 Subject: [PATCH] Revert "Fix showing SPF record" This reverts commit 7ec3b30b7071b2047d2cb495458c54d746204d8e. --- htdocs/admin/mails.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 3dcf26fea0a..25d6264bca6 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,18 +1059,20 @@ if ($action == 'edit') { } // Test SPF default automatic email from $defaultnoreplyemail = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - $dnsinfo = false; - if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { - $arrayofemailparts = explode('@', $defaultnoreplyemail); - if (count($arrayofemailparts) == 2) { - $domain = $arrayofemailparts[1]; - $dnsinfo = dns_get_record($domain, DNS_TXT); + if ($defaultnoreplyemail != $companyemail) { // We show if email differs + $dnsinfo = false; + if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { + $arrayofemailparts = explode('@', $defaultnoreplyemail); + if (count($arrayofemailparts) == 2) { + $domain = $arrayofemailparts[1]; + $dnsinfo = dns_get_record($domain, DNS_TXT); + } } - } - if (!empty($dnsinfo) && is_array($dnsinfo)) { - foreach ($dnsinfo as $info) { - if (strpos($info['txt'], 'v=spf') !== false) { - $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); + if (!empty($dnsinfo) && is_array($dnsinfo)) { + foreach ($dnsinfo as $info) { + if (strpos($info['txt'], 'v=spf') !== false) { + $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); + } } } }