Revert "Fix showing SPF record"

This reverts commit 7ec3b30b70.
This commit is contained in:
Laurent Destailleur 2024-09-04 11:16:52 +02:00
parent 7ec3b30b70
commit c8d6281b3e

View file

@ -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 ? '<br><br>' : '').$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 ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']);
}
}
}
}