diff --git a/main.py b/main.py index 761e133..f91f579 100644 --- a/main.py +++ b/main.py @@ -111,7 +111,7 @@ def run_poll_loop(agent: EmailAgent, channel: EmailChannel, poll_interval: int) body=reply, in_reply_to=msg["message_id"], references=msg["references"], - quoted_text=msg["body"], + quoted_text=msg["raw_body"], quoted_from=msg["from"], ) except Exception: diff --git a/src/channels/email_channel.py b/src/channels/email_channel.py index 624407b..42e7ee8 100644 --- a/src/channels/email_channel.py +++ b/src/channels/email_channel.py @@ -178,8 +178,8 @@ class EmailChannel: in_reply_to = msg.get("In-Reply-To", "").strip() references = msg.get("References", "").strip() - body = _extract_text(msg) - body = _strip_quoted_text(body) + raw_body = _extract_text(msg) + body = _strip_quoted_text(raw_body) if not body.strip(): imap.store(num, "+FLAGS", "\\Seen") @@ -193,6 +193,7 @@ class EmailChannel: "in_reply_to": in_reply_to, "references": references, "body": body, + "raw_body": raw_body, } ) imap.store(num, "+FLAGS", "\\Seen")