From 166f4298f9700230010f46515cef9200d6b8e87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Poulain?= Date: Mon, 24 Aug 2020 20:02:27 +0200 Subject: [PATCH] ajoute une option verbose --- mailing.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mailing.py b/mailing.py index c16d57d..1255084 100755 --- a/mailing.py +++ b/mailing.py @@ -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