Last active
December 10, 2019 08:05
-
-
Save dapi/cf4a50cee52f361656f3decf3ac36c0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpfChecker | |
Response = Struct.new(:correct, :spf_value, :message) | |
def initialize(value) | |
@value | |
end | |
def check(domain) | |
result = Net::DNS::Resolver.start(domain, Net::DNS::TXT) | |
values = result.each_mx.map(&:txt) | |
Response.new( correct: values&.include?(VALID_VALUE), spf_value: values, message: message).freeze | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment