fix maildata handling after prematurely merging #369

This commit is contained in:
holger krekel
2024-07-13 19:20:06 +02:00
parent c1fd573de2
commit c4f46dc499
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -71,11 +71,11 @@ def maildata(request):
assert datadir.exists(), datadir
def maildata(name, **kwargs):
def maildata(name, from_addr, to_addr, subject="..."):
# Using `.read_bytes().decode()` instead of `.read_text()` to preserve newlines.
data = datadir.joinpath(name).read_bytes().decode()
text = data.format(**kwargs)
text = data.format(from_addr=from_addr, to_addr=to_addr, subject=subject)
return BytesParser(policy=policy.default).parsebytes(text.encode())
return maildata