Merge remote-tracking branch 'origin/master'

This commit is contained in:
Geoffrey Frogeye 2021-12-28 12:35:44 +01:00
commit 404c7f3510

View file

@ -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 = "********"
@ -188,7 +194,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)