Module: Sisimai::Reason::FailedSTARTTLS

Defined in:
lib/sisimai/reason/failedstarttls.rb

Overview

Sisimai::Reason::FailedSTARTTLS checks the bounce reason is “failedstarttls” or not. This class is called only Sisimai::Reason class.

Constant Summary collapse

Index =

Email delivery failed due to STARTTLS related problem

[
  'starttls is required to send mail',
  'tls required but not supported',   # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



14
# File 'lib/sisimai/reason/failedstarttls.rb', line 14

def description; return "Email delivery failed due to STARTTLS related problem"; end

.match(argv1) ⇒ Boolean

Try to match that the given text and regular expressions

Parameters:

  • argv1 (String)

    String to be matched with regular expressions

Returns:

  • (Boolean)

    false: Did not match, true: Matched



19
20
21
22
23
# File 'lib/sisimai/reason/failedstarttls.rb', line 19

def match(argv1)
  return false if argv1.nil? || argv1.empty?
  return true  if Index.any? { |a| argv1.include?(a) }
  return false
end

.textObject



13
# File 'lib/sisimai/reason/failedstarttls.rb', line 13

def text; return 'failedstarttls'; end

.true(argvs) ⇒ Boolean

Email delivery failed due to STARTTLS related problem

Parameters:

Returns:

  • (Boolean)

    true: FailedSTARTTLS false: Not FailedSTARTTLS

See Also:



30
31
32
33
34
# File 'lib/sisimai/reason/failedstarttls.rb', line 30

def true(argvs)
  return true if argvs["reason"] == "failedstarttls" || argvs["command"] == "STARTTLS"
  return true if [523, 524, 538].index(argvs["replycode"].to_i)
  return match(argvs["diagnosticcode"].downcase)
end