module Sisimai::Reason::Rejected
Sisimai::Reason::Rejected
checks the bounce reason is “rejected” or not. This class is called only Sisimai::Reason
class.
This is the error that a connection to destination server was rejected by a sender's email address (envelope from). Sisimai
set “rejected” to the reason of email bounce if the value of Status: field in a bounce email is “5.1.8” or the connection has been rejected due to the argument of SMTP
MAIL command.
<kijitora@example.org>: Connected to 192.0.2.225 but sender was rejected. Remote host said: 550 5.7.1 <root@nijo.example.jp>... Access denied
Constants
- Index
- IsNot
Public Class Methods
# File lib/sisimai/reason/rejected.rb, line 72 def description; return "Email rejected due to a sender's email address (envelope from)"; end
Try to match that the given text and regular expressions @param [String] argv1 String
to be matched with regular expressions @return [True,False] false: Did not match
true: Matched
# File lib/sisimai/reason/rejected.rb, line 78 def match(argv1) return nil unless argv1 return false if IsNot.any? { |a| argv1.include?(a) } return true if Index.any? { |a| argv1.include?(a) } return false end
# File lib/sisimai/reason/rejected.rb, line 71 def text; return 'rejected'; end
Rejected
by the envelope sender address or not @param [Sisimai::Data] argvs Object to be detected the reason @return [True,False] true: is rejected
false: is not rejected by the sender
@see www.ietf.org/rfc/rfc2822.txt
# File lib/sisimai/reason/rejected.rb, line 90 def true(argvs) return true if argvs.reason == 'rejected' tempreason = Sisimai::SMTP::Status.name(argvs.deliverystatus) || 'undefined' return true if tempreason == 'rejected' # Delivery status code points "rejected". # Check the value of Diagnosic-Code: header with patterns diagnostic = argvs.diagnosticcode.downcase commandtxt = argvs.smtpcommand if commandtxt == 'MAIL' # The session was rejected at 'MAIL FROM' command return true if match(diagnostic) elsif commandtxt == 'DATA' # The session was rejected at 'DATA' command if tempreason != 'userunknown' # Except "userunknown" return true if match(diagnostic) end elsif %w[onhold undefined securityerror systemerror].include?(tempreason) # Try to match with message patterns when the temporary reason # is "onhold", "undefined", "securityerror", or "systemerror" return true if match(diagnostic) end return false end