Module: Sisimai::LDA
- Defined in:
- lib/sisimai/lda.rb
Overview
Sisimai::LDA - Error message decoder for LDA
Constant Summary collapse
- LocalAgent =
{ # Each error message should be a lower-cased string # dovecot/src/deliver/deliver.c # 11: #define DEFAULT_MAIL_REJECTION_HUMAN_REASON \ # 12: "Your message to <%t> was automatically rejected:%n%r" "dovecot" => ["Your message to <", "> was automatically rejected:"], "mail.local" => ["mail.local: "], "procmail" => ["procmail: ", "/procmail "], "maildrop" => ["maildrop: "], "vpopmail" => ["vdelivermail: "], "vmailmgr" => ["vdeliver: "], }.freeze
- MessagesOf =
{ # Each error message should be a lower-cased string "dovecot" => { # dovecot/src/deliver/mail-send.c:94 "mailboxfull" => [ "not enough disk space", "quota exceeded", # Dovecot 1.2 dovecot/src/plugins/quota/quota.c "quota exceeded (mailbox for user is full)", # dovecot/src/plugins/quota/quota.c ], "userunknown" => ["mailbox doesn't exist: "], }, "mail.local" => { "mailboxfull" => [ "disc quota exceeded", "mailbox full or quota exceeded", ], "systemerror" => ["temporary file write error"], "userunknown" => [ ": invalid mailbox path", ": unknown user:", ": user missing home directory", ": user unknown", ], }, "procmail" => { "mailboxfull" => ["quota exceeded while writing", "user over quota"], "systemerror" => ["service unavailable"], "systemfull" => ["no space left to finish writing"], }, "maildrop" => { "userunknown" => ["cannot find system user", "invalid user specified."], "mailboxfull" => ["maildir over quota."], }, "vpopmail" => { "filtered" => ["user does not exist, but will deliver to "], "mailboxfull" => ["domain is over quota", "user is over quota"], "suspend" => ["account is locked email bounced"], "userunknown" => ["sorry, no mailbox here by that name."], }, "vmailmgr" => { "mailboxfull" => ["delivery failed due to system quota violation"], "userunknown" => [ "invalid or unknown base user or domain", "invalid or unknown virtual user", "user name does not refer to a virtual user", ], }, }.freeze
Class Method Summary collapse
-
.find(argvs) ⇒ String
abstract
Bounce reason.
Class Method Details
.find(argvs) ⇒ String
This method is abstract.
Decodes the message body and return the LDA name, the reason, and the error message
Returns Bounce reason.
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/lda.rb', line 70 def find(argvs) return "" if argvs.nil? return "" if argvs["diagnosticcode"].empty? return "" if argvs["command"] != "" && argvs["command"] != "DATA" deliversby = "" # [String] Local Delivery Agent name reasontext = "" # [String] Error reason issuedcode = argvs["diagnosticcode"].downcase LocalAgent.each_key do |e| # Find a lcoal delivery agent name from the entire message body next if LocalAgent[e].none? { |a| issuedcode.include?(a) } deliversby = e; break end return "" if deliversby.empty? MessagesOf[deliversby].each_key do |e| # The key is a bounce reason name next if MessagesOf[deliversby][e].none? { |a| issuedcode.include?(a) } reasontext = e; break end reasontext = "mailererror" if reasontext.empty? return reasontext end |