https://github.com/smkent/replyowl
🦉 📤 Email reply body generator for HTML and text
https://github.com/smkent/replyowl
email html mime plaintext python
Last synced: about 1 month ago
JSON representation
🦉 📤 Email reply body generator for HTML and text
- Host: GitHub
- URL: https://github.com/smkent/replyowl
- Owner: smkent
- License: gpl-3.0
- Created: 2022-03-01T19:56:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T02:03:36.000Z (4 months ago)
- Last Synced: 2025-04-22T15:12:35.395Z (about 1 month ago)
- Topics: email, html, mime, plaintext, python
- Language: Python
- Homepage:
- Size: 313 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replyowl: Email reply body generator for HTML and text in Python
[][pypi]
[][pypi]
[][gh-actions]
[][codecov]
[][repo][![replyowl][logo]](#)
replyowl creates email bodies with quoted messages. Provide the original message
and your reply message, and replyowl will combine them into a new message. The
returned content can be used as the text and/or HTML body content of a new
email. HTML-to-text conversion is performed with [html2text][html2text].## Installation
[replyowl is available on PyPI][pypi]:
```console
pip install replyowl
```## Usage
```py
from replyowl import ReplyOwlowl = ReplyOwl()
text, html = owl.compose_reply(
content="New reply content",
quote_attribution="You wrote:",
quote_text="Original message text",
quote_html="Original message text",
)print(text)
# _New_ reply **content**
#
# ----
#
# You wrote:
#
# > Original message textprint(html) # (output formatted for readability)
#
#
#
#
#
#
# New reply content
#You wrote:
#
#
# Original message text
#
#
#
```Links in HTML are preserved when creating plain text email bodies:
```py
from replyowl import ReplyOwlowl = ReplyOwl()
text, html = owl.compose_reply(
content=(
'Check this out
'
'Or this: https://example.net/'
),
quote_attribution="You wrote:",
quote_text="Send me a URL",
quote_html="Send me a URL",
)print(text)
# Check this (https://example.com/) out
# Or this: https://example.net/
#
# ----
#
# You wrote:
#
# > Send me a URL
```If the quoted HTML content contains a `` tag, that is preserved:
```py
from replyowl import ReplyOwlowl = ReplyOwl()
text, html = owl.compose_reply(
content="Hello there",
quote_attribution="You wrote:",
quote_text="Hi",
quote_html='Hi',
)print(html) # (output formatted for readability)
#
#
# Hello there
#
# You wrote:
#
#
# Hi
#
#
#
```A custom value can be provided for the `
`'s `style` tag:
```py
from replyowl import ReplyOwlowl = ReplyOwl(blockquote_style="font-weight: bold;")
text, html = owl.compose_reply(
text, html = owl.compose_reply(
content="Your quote is in bold",
quote_attribution="You wrote:",
quote_text="I'm going to be in bold when you reply",
quote_html="I'm going to be in bold when you reply",
)
)print(html) # (output formatted for readability)
#
#
# Your quote is in bold
#
# You wrote:
#
#
#
#
```## Development
### [Poetry][poetry] installation
Via [`pipx`][pipx]:
```console
pip install pipx
pipx install poetry
pipx inject poetry poetry-pre-commit-plugin
```Via `pip`:
```console
pip install poetry
poetry self add poetry-pre-commit-plugin
```### Development tasks
* Setup: `poetry install`
* Run static checks: `poetry run poe lint` or
`poetry run pre-commit run --all-files`
* Run static checks and tests: `poetry run poe test`---
Created from [smkent/cookie-python][cookie-python] using
[cookiecutter][cookiecutter][codecov]: https://codecov.io/gh/smkent/replyowl
[cookie-python]: https://github.com/smkent/cookie-python
[cookiecutter]: https://github.com/cookiecutter/cookiecutter
[gh-actions]: https://github.com/smkent/replyowl/actions?query=branch%3Amain
[html2text]: https://github.com/Alir3z4/html2text
[logo]: https://raw.github.com/smkent/replyowl/main/img/replyowl.png
[pipx]: https://pypa.github.io/pipx/
[poetry]: https://python-poetry.org/docs/#installation
[pypi]: https://pypi.org/project/replyowl/
[repo]: https://github.com/smkent/replyowl