Registry / communication / flufl-bounce

flufl-bounce

JSON →
library5.0.1pypypiunverified

flufl.bounce is a Python library designed for robust detection and parsing of email bounce messages. It helps identify undeliverable emails, extract recipient information, and understand the reason for delivery failures. The current major version is 4.0, released in August 2023, and it receives updates as needed, typically for Python compatibility or bug fixes.

pip install flufl-bounce
INSTALL
IMPORT
SIG · FLUFL-BOUNCE
F
flufl-bounce
communicationpythonv5.0.1
Install
1.7s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.000s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Bounce
from flufl.bounce import Bounce
from flufl.bounce import Bounce

This quickstart demonstrates how to parse a raw bounce email string into an `email.message.Message` object, then use `flufl.bounce.Bounce` to detect if it's a bounce and extract key information like bounce type, failed recipients, and diagnostic codes. Remember to always pass an `email.message.Message` object to the `Bounce` constructor.

from email import message_from_string from flufl.bounce import Bounce # Simulate a bounce email content bounce_email_content = """ From: MAILER-DAEMON@example.com To: original_sender@example.com Subject: Undelivered Mail Returned to Sender This is the mail system at host example.com. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. <nonexistent@example.com>: host mail.example.com[192.0.2.1] said: 550 5.1.1 <nonexistent@example.com>: Recipient address rejected: User unknown """ # Parse the raw email string into an email.message.Message object msg = message_from_string(bounce_email_content) # Create a Bounce object from the parsed message bounce = Bounce(msg) print(f"Is this a bounce message? {bounce.is_bounce}") if bounce.is_bounce: print(f"Bounce type: {bounce.type}") print(f"Failed recipients: {bounce.recipients}") print(f"Diagnostic code: {bounce.diagnostic_code}") else: print("Not recognized as a bounce by flufl.bounce.")
Debug
Known issues
breakingThe `Bounce` constructor now strictly requires an `email.message.Message` object. Passing a raw string will result in a TypeError.
fix
Before passing to `Bounce`, convert your raw email string or bytes using `email.message_from_string()` or `email.message_from_bytes()` from the standard library's `email` module. Example: `msg = message_from_string(raw_email_content); bounce = Bounce(msg)`.
affects: 3.0, 4.0+
breakingThe `is_bounce` attribute has changed from a method (`bounce.is_bounce()`) to a property (`bounce.is_bounce`).
fix
Remove parentheses when accessing `is_bounce`. Change `bounce.is_bounce()` to `bounce.is_bounce`.
affects: 4.0+
breakingPython 3.7 is no longer supported. The minimum required Python version is 3.8.
fix
Upgrade your Python environment to 3.8 or newer to use `flufl-bounce` 4.0+.
affects: 4.0+
breakingThe `Detector` class has been removed. Its functionality is now integrated directly into the `Bounce` class.
fix
Migrate your code to use the `Bounce` class directly for bounce detection and parsing. The `Bounce` object itself now encapsulates the detection logic.
affects: 4.0+
Upgrade
Version history
5.0.1latest on PyPI · released May 22, 2026
Audit
Dependencies
flufl-enumrequiredInternal dependency for enum functionality
flufl-i18nrequiredInternal dependency for internationalization
Agent activity
28 hits · last 30 days
node
25
OpenAI (training)
1
Resources
flufl-bounce — pip install flufl-bounce · libregistry