Skip to content

Commit

Permalink
fixes issue #9 , check if records exists
Browse files Browse the repository at this point in the history
Signed-off-by: Dieter Coopman <[email protected]>
  • Loading branch information
dietercoopman committed Jan 12, 2024
1 parent 9c63438 commit b9b8142
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Mailspfchecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ private function retreiveSpfRecordsFromSendingServer(): array
$domain = implode('.', $explodedServerUrl);
if ($domain) {
$record = $checker->getRecordFromDomain($domain);
foreach ($record->getTerms() as $term) {
if ($term instanceof Mechanism\IncludeMechanism || $term instanceof Mechanism\AMechanism) {
$domainSpec = (string) $term->getDomainSpec();
if (strstr($domainSpec, $domain)) {
$spfRecords[] = $domainSpec;
if($record) {
foreach ($record->getTerms() as $term) {
if ($term instanceof Mechanism\IncludeMechanism || $term instanceof Mechanism\AMechanism) {
$domainSpec = (string)$term->getDomainSpec();
if (strstr($domainSpec, $domain)) {
$spfRecords[] = $domainSpec;
}
}
}
}
Expand Down

0 comments on commit b9b8142

Please sign in to comment.