Module: Sisimai::Order

Defined in:
lib/sisimai/order.rb

Overview

Sisimai::Order - Parent class for making optimized order list for calling MTA modules

Constant Summary collapse

OrderE0 =

There are another patterns in the value of “Subject:” header of a bounce mail generated by the following MTA/ESP modules

[
  'Sisimai::Lhost::Exim',
  'Sisimai::Lhost::Sendmail',
  'Sisimai::Lhost::Exchange2007',
  'Sisimai::Lhost::Exchange2003',
  'Sisimai::Lhost::AmazonSES',
  'Sisimai::Lhost::TrendMicro',
  'Sisimai::Lhost::DeutscheTelekom',
  'Sisimai::Lhost::KDDI',
  'Sisimai::Lhost::FML',
  'Sisimai::Lhost::Verizon',
  'Sisimai::Lhost::ApacheJames',
  'Sisimai::Lhost::X2',
].freeze
OrderE1 =

Fallback list: The following MTA/ESP modules is not listed OrderE0

[
  'Sisimai::Lhost::Postfix',
  'Sisimai::Lhost::OpenSMTPD',
  'Sisimai::Lhost::Qmail',
  'Sisimai::Lhost::Courier',
  'Sisimai::Lhost::MessagingServer',
  'Sisimai::Lhost::GoogleWorkspace',
  'Sisimai::Lhost::Gmail',
  'Sisimai::Lhost::GMX',
  'Sisimai::Lhost::Zoho',
  'Sisimai::Lhost::Domino',
  'Sisimai::Lhost::Notes',
  'Sisimai::Lhost::IMailServer',
  'Sisimai::Lhost::Activehunter',
  'Sisimai::Lhost::MFILTER',
  'Sisimai::Lhost::MailFoundry',
  'Sisimai::Lhost::GoogleGroups',
  'Sisimai::Lhost::MailMarshal',
  'Sisimai::Lhost::V5sendmail',
  'Sisimai::Lhost::EZweb',
  'Sisimai::Lhost::Biglobe',
  'Sisimai::Lhost::EinsUndEins',
  'Sisimai::Lhost::DragonFly',
  'Sisimai::Lhost::X1',
  'Sisimai::Lhost::X3',
  'Sisimai::Lhost::X6',
].freeze
Subject =

The following order is decided by the first 2 words of Subject: header

{
  'abuse-report'     => ['Sisimai::ARF'],
  'auto'             => ['Sisimai::RFC3834'],
  'auto-reply'       => ['Sisimai::RFC3834'],
  'automatic-reply'  => ['Sisimai::RFC3834'],
  'aws-notification' => ['Sisimai::Lhost::AmazonSES'],
  'complaint-about'  => ['Sisimai::ARF'],
  'delivery-failure' => ['Sisimai::Lhost::Domino', 'Sisimai::Lhost::X2'],
  'delivery-notification' => ['Sisimai::Lhost::MessagingServer'],
  'delivery-status'  => [
    'Sisimai::Lhost::OpenSMTPD',
    'Sisimai::Lhost::GoogleWorkspace',
    'Sisimai::Lhost::Gmail',
    'Sisimai::Lhost::GoogleGroups',
    'Sisimai::Lhost::AmazonSES',
    'Sisimai::Lhost::X3',
  ],
  'dmarc-ietf-dmarc' => ['Sisimai::ARF'],
  'email-feedback'   => ['Sisimai::ARF'],
  'failed-delivery'  => ['Sisimai::Lhost::X2'],
  'failure-delivery' => ['Sisimai::Lhost::X2'],
  'failure-notice'   => [
    'Sisimai::Lhost::Qmail',
    'Sisimai::Lhost::MFILTER',
    'Sisimai::Lhost::Activehunter',
  ],
  'loop-alert'    => ['Sisimai::Lhost::FML'],
  'mail-delivery' => [
    'Sisimai::Lhost::Exim',
    'Sisimai::Lhost::DragonFly',
    'Sisimai::Lhost::GMX',
    'Sisimai::Lhost::Zoho',
    'Sisimai::Lhost::EinsUndEins',
    'Sisimai::Lhost::DeutscheTelekom',
  ],
  'mail-could'   => ['Sisimai::Lhost::TrendMicro'],
  'mail-failed'  => ['Sisimai::Lhost::DeutscheTelekom'],
  'mail-failure' => ['Sisimai::Lhost::Exim'],
  'mail-system'  => ['Sisimai::Lhost::EZweb'],
  'message-delivery' => ['Sisimai::Lhost::MailFoundry'],
  'message-frozen'   => ['Sisimai::Lhost::Exim'],
  'non-recapitabile' => ['Sisimai::Lhost::Exchange2007'],
  'non-remis' => ['Sisimai::Lhost::Exchange2007'],
  'notice'    => ['Sisimai::Lhost::Courier'],
  'postmaster-email'   => ['Sisimai::Lhost::Mimecast'],
  'postmaster-notify'  => ['Sisimai::Lhost::Sendmail'],
  'returned-mail' => [
    'Sisimai::Lhost::Sendmail',
    'Sisimai::Lhost::Biglobe',
    'Sisimai::Lhost::V5sendmail',
    'Sisimai::Lhost::X1',
  ],
  'there-was'          => ['Sisimai::Lhost::X6'],
  'undeliverable'      => ['Sisimai::Lhost::Exchange2007', 'Sisimai::Lhost::Exchange2003'],
  'undeliverable-mail' => ['Sisimai::Lhost::MailMarshal', 'Sisimai::Lhost::IMailServer'],
  'undeliverable-message' => ['Sisimai::Lhost::Notes', 'Sisimai::Lhost::Verizon'],
  'undelivered-mail'      => ['Sisimai::Lhost::Postfix', 'Sisimai::Lhost::Zoho'],
  'warning'               => ['Sisimai::Lhost::Sendmail', 'Sisimai::Lhost::Exim'],
}.freeze

Class Method Summary collapse

Class Method Details

.anotherArray

This method is abstract.

Make MTA module list as a spare

Returns Ordered module list.

Returns:

  • (Array)

    Ordered module list



136
# File 'lib/sisimai/order.rb', line 136

def another; return [OrderE0, OrderE1].flatten; end

.make(argv0 = '') ⇒ Array

This method is abstract.

Returns an MTA Order decided by the first word of the “Subject”: header

Returns Order of MTA modules.

Parameters:

  • argv0 (String) (defaults to: '')

    Subject header string

Returns:

  • (Array)

    Order of MTA modules

Since:

  • v4.25.4



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/sisimai/order.rb', line 118

def make(argv0 = '')
  return [] if argv0.empty?
  argv0 = argv0.downcase.tr('_[] ', ' ').squeeze(' ').sub(/\A[ ]+/, '')
  words = argv0.split(/[ ]/, 3)

  if words[0].include?(':')
    # Undeliverable: ..., notify: ...
    first = argv0.split(':').shift
  else
    # Postmaster notify, returned mail, ...
    first = words.slice(0, 2).join('-')
  end
  first.delete!(':",*')
  return Subject[first] || []
end