Metadata-Version: 2.4
Name: larzemail
Version: 0.1.0
Summary: Build, parse and send MIME email the easy way - zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzemail
Project-URL: Repository, https://github.com/larz-scripter/larzemail
Project-URL: Issues, https://github.com/larz-scripter/larzemail/issues
Keywords: email,mime,smtp,attachments,mail,parser,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzemail

**Build, parse and send MIME email the easy way — zero dependencies.**

Python's `email` package is powerful and famously awkward. larzemail wraps it in
a one-object API: set a subject, text and/or HTML body, and attachments, then get
valid MIME bytes — or parse a raw message straight back into a plain object. It
also sends over SMTP, with an injectable connection so your sending code stays
unit-testable.

## Install

```bash
pip install larzemail
```

## Use

```python
from larzemail import Email

msg = (Email(subject="Your receipt", from_addr="billing@acme.com",
             to=["ada@example.com"], cc="ops@acme.com")
       .body(text="Thanks for your order.",
             html="<h1>Thanks!</h1><p>Your order shipped.</p>")
       .attach("receipt.pdf", pdf_bytes, "application/pdf"))

raw = msg.as_bytes()                 # valid MIME, ready to send
msg.send(host="smtp.acme.com", port=587, username="u", password="p", use_tls=True)

parsed = Email.parse(raw)            # -> ParsedEmail
parsed.subject, parsed.text, parsed.html, parsed.attachments
```

### Testable sending

```python
msg.send(connection=fake_smtp)       # any object with send_message(msg, from_addr, to_addrs)
```

## Tests

```bash
python -m unittest discover -s tests -v   # 9 tests
```

## The Larz stack

One of 60+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter). Pairs with
[larzpdf](https://github.com/larz-scripter/larzpdf) (attach a generated invoice)
and [larzical](https://github.com/larz-scripter/larzical) (attach a calendar
invite).

## License

MIT (c) larz-scripter
