Module: Sisimai::RFC3464::ThirdParty::PowerMTA
- Defined in:
- lib/sisimai/rfc3464/thirdparty.rb
Constant Summary collapse
- FieldGroup =
{ "x-powermta-virtualmta" => "host", # X-PowerMTA-VirtualMTA: mx22.neko.example.jp "x-powermta-bouncecategory" => "text", # X-PowerMTA-BounceCategory: bad-mailbox }.freeze
- MessagesOf =
X-PowerMTA-BounceCategory: bad-mailbox
{ "bad-domain" => "hostunknown", "bad-mailbox" => "userunknown", "inactive-mailbox" => "suspend", "message-expired" => "expired", "no-answer-from-host" => "networkerror", "policy-related" => "policyviolation", "quota-issues" => "mailboxfull", "routing-errors" => "systemerror", "spam-related" => "spamdetected", }.freeze
Class Method Summary collapse
-
.xfield(argv1 = "") ⇒ Object
Returns an array which is compatible with the value returned from Sisimai::RFC1894->field().
Class Method Details
.xfield(argv1 = "") ⇒ Object
Returns an array which is compatible with the value returned from Sisimai::RFC1894->field()
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/sisimai/rfc3464/thirdparty.rb', line 68 def xfield(argv1 = "") return [] if argv1.nil? || argv1.empty? fieldparts = argv1.split(":", 2) xfieldname = fieldparts[0].downcase xgroupname = FieldGroup[xfieldname]; return [] if xgroupname.nil? xfieldlist = ["", "", fieldparts[1].split.join(" "), xgroupname, "", "PowerMTA"] # - 0: Field-Name # - 1: Sub Type: RFC822, DNS, X-Unix, and so on) # - 2: Value # - 3: Field Group(addr, code, date, host, stat, text) # - 4: Comment # - 5: 3rd Party MTA-Name if xfieldname == "x-powermta-bouncecategory" # X-PowerMTA-BounceCategory: bad-mailbox # Set the bounce reason picked from the value of the field xfieldlist[0] = xfieldname xfieldlist[4] = sprintf("reason:%s", (MessagesOf[xfieldlist[2]] || "")) elsif xfieldname == "x-powermta-virtualmta" # X-PowerMTA-VirtualMTA: mx22.neko.example.jp xfieldlist[0] = "Reporting-MTA" end return xfieldlist end |