Package lamson :: Module bounce :: Class BounceAnalyzer
[hide private]
[frames] | no frames]

Class BounceAnalyzer

source code



BounceAnalyzer collects up the score and the headers and gives more
meaningful interaction with them.  You can keep it simple and just use
is_hard, is_soft, and probable methods to see if there was a bounce.
If you need more information then attributes are set for each of the following:

    * primary_status -- The main status number that determines hard vs soft.
    * secondary_status -- Advice status.
    * combined_status -- the 2nd and 3rd number combined gives more detail.
    * remote_mta -- The MTA that you sent mail to and aborted.
    * reporting_mta -- The MTA that was sending the mail and has to report to you.
    * diagnostic_codes -- Human readable codes usually with info from the provider.
    * action -- Usually 'failed', and turns out to be not too useful.
    * content_parts -- All the attachments found as a hash keyed by the type.
    * original -- The original message, if it's found.
    * report -- All report elements, as lamson.encoding.MailBase raw messages.
    * notification -- Usually the detailed reason you bounced.

Instance Methods [hide private]
 
__init__(self, headers, score)
Initializes all the various attributes you can use to analyze the bounce results.
source code
 
is_hard(self)
Tells you if this was a hard bounce, which is determined by the message being a probably bounce with a primary_status greater than 4.
source code
 
is_soft(self)
Basically the inverse of is_hard()
source code
 
probable(self, threshold=0.3)
Determines if this is probably a bounce based on the score probability.
source code
 
error_for_humans(self)
Constructs an error from the status codes that you can print to a user.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, headers, score)
(Constructor)

source code 

Initializes all the various attributes you can use to analyze the bounce results.

Overrides: object.__init__

is_hard(self)

source code 

Tells you if this was a hard bounce, which is determined by the message being a probably bounce with a primary_status greater than 4.

is_soft(self)

source code 

Basically the inverse of is_hard()

probable(self, threshold=0.3)

source code 

Determines if this is probably a bounce based on the score probability. Default threshold is 0.3 which is conservative.

error_for_humans(self)

source code 

Constructs an error from the status codes that you can print to a user.