On Fri, Apr 24, 2026 at 09:22:51PM +0200, Peter Zijlstra wrote:
> mdir = mailbox.Maildir('~/Maildir/');
>
> for i, r in enumerate(reviews):
> inline = r.get('inline_review', '') or ''
> if not inline:
> continue
>
> author_name = r.get('author_name', 'Sashiko Reviewer')
> author_email = r.get('author_email', '[email protected]')
>
> msgid = msgids[r['patch_id']]
> subject = subjects[r['patch_id']]
>
> # Create the Email object
> msg = EmailMessage()
> msg['Subject'] = f"Re: {subject}"
> msg['From'] = f"{author_name} <{author_email}>"
> msg['To'] = "[email protected]"
> msg['Date'] = formatdate(localtime=True)
>
> # The critical threading headers
> msg['Message-ID'] = f"<review-{i}-{msgid}>"
> msg['References'] = f"<{msgid}>"
> msg['In-Reply-To'] = f"<{msgid}>"
>
> msg.set_content(inline)
>
> mdir.add(msg)
>
> mdir.flush()
So Ideally I would have 'Reply-to' header set to the original sender and
added 'Cc' like the original email. However, AFAICT the JSON does not
contain this information, and while I could use the mdir object to find
the original message in my Inbox, this is incredibly slow.
I have a TODO to use python-notmuch to do this, but haven't gotten
around to doing this yet.
With that 'fixed' I could actually reply to these messages and it would
all 'just' work. For now I copy/paste when needed.