class EmailDetected::Checker::MailCheckStatus
Attributes
errors[RW]
Public Class Methods
new(response_code, error = nil)
click to toggle source
# File lib/email_detected/checker.rb, line 31 def initialize(response_code, error = nil) errors = [] errors.push(EmailDetected::MESSAGES[response_code]) unless error.nil? @response = (self.class.rcpt_responses.key?(response_code) ? response_code : -1) @errors = errors end
rcpt_responses()
click to toggle source
# File lib/email_detected/checker.rb, line 10 def self.rcpt_responses @@rcpt_responses ||= { -1 => :fail, # Validation failed (non-SMTP) 250 => :valid, # Requested mail action okay, completed 251 => :dunno, # User not local; will forward to <forward-path> 550 => :invalid, # Requested action not taken:, mailbox unavailable 551 => :dunno, # User not local; please try <forward-path> 552 => :valid, # Requested mail action aborted:, exceeded storage allocation 553 => :invalid, # Requested action not taken:, mailbox name not allowed 450 => :valid_fails, # Requested mail action not taken:, mailbox unavailable 451 => :valid_fails, # Requested action aborted:, local error in processing 452 => :valid_fails, # Requested action not taken:, insufficient system storage 500 => :fail, # Syntax error, command unrecognised 501 => :invalid, # Syntax error in parameters or arguments 503 => :fail, # Bad sequence of commands 521 => :invalid, # <domain> does not accept mail [rfc1846] 421 => :fail # <domain> Service not available, closing transmission channel } end
Public Instance Methods
invalid?()
click to toggle source
true if verified address is known to be invalid
# File lib/email_detected/checker.rb, line 56 def invalid? status == :invalid end
status()
click to toggle source
Symbolic status of mail address verification.
- :fail
-
Verification failed
- :dunno
-
Verification succeeded, but can't tell about validity
- :valid
-
address known to be valid
- :valid_fails
-
address known to be valid, delivery would have failed temporarily
- :invalid
-
address known to be invalid
# File lib/email_detected/checker.rb, line 46 def status @@rcpt_responses[@response] end
valid?()
click to toggle source
true if verified address is known to be valid
# File lib/email_detected/checker.rb, line 51 def valid? %i[valid valid_fails].include? status end