Module: Sisimai::Reason::VirusDetected

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

Overview

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

This is an error that any virus or trojan horse detected in the message by a virus scanner program at a destination mail server. This reason has been divided from "SecurityError" at Sisimai 4.22.0.

Your message was infected with a virus. You should download a virus
scanner and check your computer for viruses.

Sender:    <sironeko@libsisimai.org>
Recipient: <kijitora@example.jp>

Constant Summary collapse

Index =
["it has a potentially executable attachment"].freeze
Pairs =
[
  ["message was ", "ected", " virus"],
  ["virus", " detected"],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



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

def description; return 'Email rejected due to a virus scanner on a destination host'; 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

Since:

  • 4.22.0



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

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/virusdetected.rb', line 24

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

.true(argvs) ⇒ Boolean

The bounce reason is "VirusDetected" or not

Parameters:

Returns:

  • (Boolean)

    true: virus detected false: virus was not detected

See Also:

Since:

  • 4.22.0



44
45
46
47
48
49
50
51
# File 'lib/sisimai/reason/virusdetected.rb', line 44

def true(argvs)
  # The value of "reason" isn't "visusdetected" when the value of "command" is an SMTP command
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
  # entire message body after the DATA command.
  return true  if argvs['reason'] == Sisimai::Eb::ReEXEC
  return false if Sisimai::SMTP::Command::ExceptDATA.include?(argvs['command'])
  return match(argvs['diagnosticcode'].downcase)
end