mlocati / spf-lib

PHP library to parse, build and validate SPF (Sender Policy Framework) DNS records
MIT License
54 stars 6 forks source link

Can I supply the starting SPF record? #24

Closed gunsuka closed 2 years ago

gunsuka commented 2 years ago

Is there any way to use this library by supplying the IP, and SPF record to see if it is a valid IP according to the SPF record I provide?

Currently you can supply the IP & domain name and it will lookup the TXT record in DNS.

I would like to supply my own starting TXT record and an associated IP address. Then the system could perform its checks. Possible?

mlocati commented 2 years ago

Sure: you can use the SPFLib\Check\Environment class to do that.

mlocati commented 2 years ago

You can also use a custom SPFLib\DNS\Resolver class to emulate a TXT record for specific domains.

gunsuka commented 2 years ago

That is fantastic that the library can already do it. Is there any documentation or example? I looked through the code but I can't see anything that looks like I would be able to push an IP address and SPF record into the system.

mlocati commented 2 years ago

No documentation. You can use the SPFLib\Checker class.