Module: Sisimai::Reason::EmailTooLarge

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

Overview

This is the error that a sent email size is too big for a destination mail server. In many case, There are many attachment files with email, or the file size is too large. Sisimai will set "EmailTooLarge" to the reason of email bounce if the value of Status: field in a bounce email is "5.2.3" or "5.3.4".

Constant Summary collapse

Index =
[
  "exceeds the maximum size ",
  "line limit exceeded",
  "message too large",
  "size limit",
  "taille limite du message atteinte",
].freeze
Pairs =
[
  ["exceeded", "message size"],
  ["message ", "exceeds ", "limit"],
  ["message ", "size", "exceed"],
  ["message ", "too", "big"],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



25
# File 'lib/sisimai/reason/emailtoolarge.rb', line 25

def description; return 'Email rejected due to an email size is too big for a destination mail server'; 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



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

def match(argv1)
  return false if argv1.nil? || argv1.empty?
  return true  if Index.any? { |a| argv1.include?(a) }
  return true  if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
  return false
end

.textObject



24
# File 'lib/sisimai/reason/emailtoolarge.rb', line 24

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

.true(argvs) ⇒ Boolean

The message size is too big for the remote host

Parameters:

Returns:

  • (Boolean)

    true: is too big message size false: is not big

See Also:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/sisimai/reason/emailtoolarge.rb', line 42

def true(argvs)
  return true if argvs['reason'] == Sisimai::Eb::ReSIZE

  statuscode = argvs['deliverystatus'] || ''
  tempreason = Sisimai::SMTP::Status.name(statuscode)

  # Delivery status code points "EmailTooLarge".
  # Status: 5.3.4
  # Diagnostic-Code: SMTP; 552 5.3.4 Error: message file too big
  #
  # Status: 5.2.3
  # Deiagnostic-Code: Message length exceeds administrative limit
  return true if tempreason == Sisimai::Eb::ReSIZE
  return match(argvs['diagnosticcode'].downcase)
end