display spf info from dns

This commit is contained in:
Frédéric FRANCE 2021-10-31 18:43:11 +01:00
parent be6b1e29ad
commit 8ce70aac5d
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 14 additions and 2 deletions

View File

@ -848,8 +848,19 @@ if ($action == 'edit') {
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
}
}
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$dnsinfo = false;
if (!empty($companyemail)) {
$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) {
$text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
}
}
}
if ($text) {
print info_admin($text);
}

View File

@ -501,6 +501,7 @@ WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to se
WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other.
WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: <strong>%s</strong>.
WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>.
ActualMailSPFRecordFound=Actual SPF record found : %s
ClickToShowDescription=Click to show description
DependsOn=This module needs the module(s)
RequiredBy=This module is required by module(s)