smtpdummy: Support Stalwart

This commit is contained in:
Geoffrey Frogeye 2025-05-26 23:40:35 +02:00
parent 4fd1028e1f
commit 3129ec76bf

View file

@ -1,6 +1,7 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3
#! nix-shell -p python3 python3Packages.colorama python3Packages.configargparse
# vim: filetype=python
import base64
import datetime
@ -60,6 +61,7 @@ if __name__ == "__main__":
default=f"Test message {now.strftime('%H:%M:%S')}",
)
parser.add_argument("-8", "--smtputf8", env_var="SMTPUTF8", action="store_true")
parser.add_argument("-C", "--crlf", env_var="CRLF", action="store_true")
parser.add_argument("-c", "--callout", env_var="CALLOUT", action="store_true")
parser.add_argument("-b", "--body", env_var="BODY", default="")
@ -188,6 +190,8 @@ Input arguments:
assert isinstance(p.stdin, io.BufferedWriter)
cmd = command.encode() + b"\n"
if args.crlf:
cmd = cmd.replace(b"\n", b"\r\n")
p.stdin.write(cmd)
p.stdin.flush()