module Sisimai::Rhost::FrancePTT

Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data object as an argument of get() method when the value of “rhost” of the object is “*.laposte.net” or “*.orange.fr”. This class is called only Sisimai::Data class.

Constants

ErrorCodes

Imported from p5-Sisimail/lib/Sisimai/Rhost/FrancePTT.pm

Public Class Methods

get(argvs) click to toggle source

Detect bounce reason from Oranage or La Poste @param [Sisimai::Data] argvs Parsed email object @return [String] The bounce reason for Orange or La Poste

# File lib/sisimai/rhost/franceptt.rb, line 134
def get(argvs)
  return argvs.reason unless argvs.reason.empty?

  statusmesg = argvs.diagnosticcode
  reasontext = ''

  if cv = statusmesg.match(/\b(LPN|LPNAAA|OFR|OUK)(_[0-9]{3}|[0-9]{3}[-_][0-9]{3})\b/i)
    # OUK_513, LPN105-104, OFR102-104, ofr_506
    v = sprintf("%03d", (cv[1] + cv[2])[-3, 3])
    reasontext = ErrorCodes[v] || 'undefined'
  end
  return reasontext
end