Yet another feature for smtpdummy

This commit is contained in:
Geoffrey Frogeye 2023-08-12 22:02:59 +02:00
parent 910e7fae63
commit 7d011694d8
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -63,6 +63,9 @@ if __name__ == "__main__":
parser.add_argument("-b", "--body", env_var="BODY", default="") parser.add_argument("-b", "--body", env_var="BODY", default="")
parser.add_argument("-g", "--gtube", env_var="GTUBE", action="store_true") parser.add_argument("-g", "--gtube", env_var="GTUBE", action="store_true")
parser.add_argument("-m", "--me", env_var="ME", default="Geoffrey") parser.add_argument("-m", "--me", env_var="ME", default="Geoffrey")
parser.add_argument(
"-H", "--headers", default=[], action="append", env_var="HEADER"
)
parser.add_argument("-y", "--dryrun", env_var="DRYRUN", action="store_true") parser.add_argument("-y", "--dryrun", env_var="DRYRUN", action="store_true")
parser.add_argument("-q", "--quiet", env_var="QUIET", action="store_true") parser.add_argument("-q", "--quiet", env_var="QUIET", action="store_true")
@ -79,7 +82,7 @@ if __name__ == "__main__":
if args.to is None: if args.to is None:
args.to = args.receiver[0] args.to = args.receiver[0]
if args.reply_to is None: if args.reply_to is None:
args.reply_to = getattr(args, 'from') args.reply_to = getattr(args, "from")
if args.password: if args.password:
password = args.password password = args.password
args.password = "********" args.password = "********"
@ -87,6 +90,10 @@ if __name__ == "__main__":
# Transmission content # Transmission content
headers = ""
if args.headers:
headers = "\n" + "\n".join(args.headers)
gtube = "" gtube = ""
if args.gtube: if args.gtube:
gtube = """ gtube = """
@ -102,7 +109,7 @@ From: {args.me} <{getattr(args, 'from')}>
Subject: {args.subject} Subject: {args.subject}
To: {args.to} To: {args.to}
Reply-To: {args.reply_to} Reply-To: {args.reply_to}
Message-ID: {mid} Message-ID: {mid}{headers}
Hello there, Hello there,