API Reference

API reference for flufl.bounce:

Top-level functions

flufl.bounce.scan_message(msg) frozenset[bytes]

Detect the set of all permanently bouncing original recipients.

Parameters:

msg (email.message.Message) – The bounce message.

Returns:

The set of detected original recipients.

flufl.bounce.all_failures(msg) tuple[frozenset[bytes], frozenset[bytes]]

Detect the set of all bouncing original recipients.

Parameters:

msg (email.message.Message) – The bounce message.

Returns:

2-tuple of the temporary failure set and permanent failure set.

Detector interfaces

Interfaces.

class flufl.bounce.interfaces.BounceDetector(*args, **kwargs)

Detect a bounce in an email message.

__init__(*args, **kwargs)
process(msg: Message) tuple[frozenset[bytes], frozenset[bytes]]

Scan an email message looking for bounce addresses.

Parameters:

msg (Message) – An email message.

Returns:

A 2-tuple of the detected temporary and permanent bouncing addresses. Both elements of the tuple are frozensets of byte email addresses. Not all detectors can tell the difference between temporary and permanent failures, in which case, the addresses will be considered to be permanently bouncing.