ajoute une option verbose

This commit is contained in:
François Poulain 2020-08-24 20:02:27 +02:00
parent 4ae4b7fe87
commit 166f4298f9
1 changed files with 11 additions and 4 deletions

View File

@ -53,6 +53,9 @@ def parse_args():
action="store_true",
help="Load data but don't send anything.",
)
parser.add_argument(
"-v", "--verbose", action="store_true",
)
parser.add_argument(
"-a",
"--attachement",
@ -180,10 +183,14 @@ def send_message(message, to, attachment, args):
if attachment:
msg.add_attachment(attachment[0], **attachment[1])
print(
"Sending : %s, from %s to %s, dests : %s"
% (subjectvalue, fromvalue, dests[0], repr(dests))
)
if args.verbose:
print(msg)
print("-" * 80)
else:
print(
"Sending : %s, from %s to %s, dests : %s"
% (subjectvalue, fromvalue, dests[0], repr(dests))
)
if not args.dry_run:
# sending the mail to its recipients using the local mailer via SMTP