smtpdummy: Multiple receivers
This commit is contained in:
parent
a801c86563
commit
b1abd45053
|
@ -38,7 +38,11 @@ if __name__ == "__main__":
|
|||
"-s", "--sender", env_var="SENDER", default="geoffrey@frogeye.fr"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r", "--receiver", env_var="RECEIVER", default="geoffrey@frogeye.fr"
|
||||
"-r",
|
||||
"--receiver",
|
||||
env_var="RECEIVER",
|
||||
default=[],
|
||||
action="append",
|
||||
)
|
||||
# parser.add_argument("-a", "--auth", env_var="AUTH", default="PLAIN")
|
||||
parser.add_argument("-u", "--user", env_var="MUSER")
|
||||
|
@ -64,12 +68,14 @@ if __name__ == "__main__":
|
|||
args = parser.parse_args()
|
||||
|
||||
# Default values
|
||||
if not args.receiver:
|
||||
args.receiver = ["geoffrey@frogeye.fr"]
|
||||
if args.helo is None:
|
||||
args.helo = args.origin
|
||||
if getattr(args, "from") is None:
|
||||
setattr(args, "from", args.sender)
|
||||
if args.to is None:
|
||||
args.to = args.receiver
|
||||
args.to = args.receiver[0]
|
||||
if args.password:
|
||||
password = args.password
|
||||
args.password = "********"
|
||||
|
@ -186,7 +192,8 @@ Input arguments:
|
|||
).decode()
|
||||
send(f"AUTH PLAIN {encoded}")
|
||||
send(f"MAIL FROM: <{args.sender}>")
|
||||
send(f"RCPT TO: <{args.receiver}>")
|
||||
for receiver in args.receiver:
|
||||
send(f"RCPT TO: <{receiver}>")
|
||||
if not args.callout:
|
||||
send("DATA")
|
||||
send(text)
|
||||
|
|
Loading…
Reference in a new issue