diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index acfafcf9370..90036b752b0 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -850,13 +850,13 @@ if ($action == 'edit') {
}
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$dnsinfo = false;
- if (!empty($companyemail)) {
+ if (!empty($companyemail) && function_exists('dns_get_record')) {
$domain = array_pop(explode('@', $companyemail));
$dnsinfo = dns_get_record($domain, DNS_TXT);
}
if (!empty($dnsinfo) && is_array($dnsinfo)) {
foreach ($dnsinfo as $info) {
- if (strpos($info['txt'], 'v=spf1') !== false) {
+ if (strpos($info['txt'], 'v=spf') !== false) {
$text .= ($text ? '
' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
}
}