Module: Sisimai::RFC3464::ThirdParty

Defined in:
lib/sisimai/rfc3464/thirdparty.rb

Defined Under Namespace

Modules: PowerMTA

Constant Summary collapse

ThirdParty =
{
  #"Aol"     => ["X-Outbound-Mail-Relay-"], # X-Outbound-Mail-Relay-(Queue-ID|Sender)
  "PowerMTA" => ["X-PowerMTA-"],            # X-PowerMTA-(VirtualMTA|BounceCategory)
  #"Yandex"  => ["X-Yandex-"],              # X-Yandex-(Queue-ID|Sender)
}.freeze

Class Method Summary collapse

Class Method Details

.is3rdparty(argv1 = "") ⇒ Object

is3rdparty() returns true if the argument is a line generated by a MTA which have fields defined in RFC3464 inside of a bounce mail the MTA returns

Parameters:

  • string

    argv1 A line of a bounce mail

Returns:

  • bool The line indicates that a bounce mail generated by the 3rd party MTA



15
16
17
18
19
# File 'lib/sisimai/rfc3464/thirdparty.rb', line 15

def is3rdparty(argv1 = "")
  cv = Sisimai::RFC3464::ThirdParty.returnedby(argv1)
  return false if cv.empty?
  return true
end

.returnedby(argv1 = "") ⇒ Object

returnedby() returns an MTA name of the 3rd party

Parameters:

  • string

    argv1 A line of a bounce mail

Returns:

  • string An MTA name of the 3rd party



24
25
26
27
28
29
30
31
32
# File 'lib/sisimai/rfc3464/thirdparty.rb', line 24

def returnedby(argv1 = "")
  return "" if argv1.nil? || argv1.start_with?("X-") == false

  ThirdParty.each_key do |e|
    # Does the argument include the 3rd party specific field?
    return e if argv1.start_with?(ThirdParty[e][0])
  end
  return ""
end

.xfield(argv1 = "") ⇒ Object

xfield() returns rfc1894.Field() compatible slice for the specific field of the 3rd party MTA

Parameters:

  • string

    argv1 A line of the error message

Returns:

  • RFC1894->field() compatible array

See Also:



38
39
40
41
42
# File 'lib/sisimai/rfc3464/thirdparty.rb', line 38

def xfield(argv1 = "")
  return [] if argv1.nil? || argv1.empty?
  party = Sisimai::RFC3464::ThirdParty.returnedby(argv1); return [] if party.empty?
  return Module.const_get("Sisimai::RFC3464::ThirdParty::#{party}").xfield(argv1)
end