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



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

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



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

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



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

def text; return 'emailtoolarge'; 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:



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

def true(argvs)
  return true if argvs['reason'] == 'emailtoolarge'

  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 == 'emailtoolarge'
  return match(argvs['diagnosticcode'].downcase)
end