Module: Sisimai::Reason::ContentError

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

Overview

Sisimai::Reason::ContentError checks the bounce reason is "ContentError" or not This class is called only Sisimai::Reason class.

This is the error that a destination mail server has rejected email due to header format of the email like the following. Sisimai will set "ContentError" to the reason of email bounce if the value of Status: field in a bounce email is "5.6.*".

Constant Summary collapse

Index =
[
  "charset not supported",
  "executable files are not allowed in compressed files",
  "header error",
  "header size exceeds maximum permitted",
  "illegal attachment on your message",
  "improper use of 8-bit data in message header",
  "it has a potentially executable attachment",
  "message contain invalid mime headers",
  "message contain improperly-formatted binary content",
  "message contain text that uses unnecessary base64 encoding",
  "message header size, or recipient list, exceeds policy limit",
  "message mime complexity exceeds the policy maximum",
  "message was blocked because its content presents a potential", # https://support.google.com/mail/answer/6590
  "routing loop detected -- too many received: headers",
  'too many "received" headers', # Exim/deliver.c:5425
  "we do not accept messages containing images or other attachments",
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



32
# File 'lib/sisimai/reason/contenterror.rb', line 32

def description; return 'Email rejected due to a header format of the email'; 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



37
38
39
40
41
# File 'lib/sisimai/reason/contenterror.rb', line 37

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

.textObject



31
# File 'lib/sisimai/reason/contenterror.rb', line 31

def text; return Sisimai::Eb::ReBODY; end

.true(argvs) ⇒ Boolean

Rejected email due to header format of the email

Parameters:

Returns:

  • (Boolean)

    true: rejected due to content error false: is not content error

See Also:



48
49
50
51
52
53
54
# File 'lib/sisimai/reason/contenterror.rb', line 48

def true(argvs)
  require 'sisimai/reason/spamdetected'
  return true  if argvs["reason"] == Sisimai::Eb::ReBLOC
  return false if Sisimai::Reason::SpamDetected.true(argvs)
  return true  if Sisimai::SMTP::Status.name(argvs["deliverystatus"]) == Sisimai::Eb::ReBODY
  return match(argvs["diagnosticcode"].downcase)
end