Update mails.php

This commit is contained in:
Laurent Destailleur 2021-11-01 02:35:15 +01:00 committed by GitHub
parent 8ce70aac5d
commit 3c69fb0ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -850,13 +850,13 @@ if ($action == 'edit') {
} }
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); $companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$dnsinfo = false; $dnsinfo = false;
if (!empty($companyemail)) { if (!empty($companyemail) && function_exists('dns_get_record')) {
$domain = array_pop(explode('@', $companyemail)); $domain = array_pop(explode('@', $companyemail));
$dnsinfo = dns_get_record($domain, DNS_TXT); $dnsinfo = dns_get_record($domain, DNS_TXT);
} }
if (!empty($dnsinfo) && is_array($dnsinfo)) { if (!empty($dnsinfo) && is_array($dnsinfo)) {
foreach ($dnsinfo as $info) { foreach ($dnsinfo as $info) {
if (strpos($info['txt'], 'v=spf1') !== false) { if (strpos($info['txt'], 'v=spf') !== false) {
$text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']); $text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
} }
} }