## ConsoleBackend


A console backend writes a rendering of each submission to a stream instead of sending it.


Usage

``` python
ConsoleBackend(
    *,
    from_address="epistole@example.invalid",
    stream=None,
)
```


It writes the plain text in full, and the HTML and each attachment as a size. Nothing should parse the rendering. It is never the bytes a backend sends. See ADR-0015.


## Parameters


`stream: TextIO | None = None`  
`None` means `sys.stdout` as it is at each send, because pytest's `capsys` and Jupyter replace it after import.


## Examples

``` python
from epistole import ConsoleBackend, Message

backend = ConsoleBackend(from_address="reports@example.com")
backend.send(
    Message(text="Weekly numbers")
    .to("ada@example.com")
    .subject("Weekly numbers")
    .attach(b"%PDF", filename="weekly.pdf")
)
# From: reports@example.com
# To: ada@example.com
# Message-ID: <179021486392.66219.11904006491029159968@example.com>
# Date: Wed, 23 Sep 2026 21:54:23 -0400
# Subject: Weekly numbers
# Attachment: weekly.pdf (application/pdf, 4 bytes)
#
# Weekly numbers
# -------------------------------------------------------------------------------
```
