diff --git a/ddec.py b/ddec.py old mode 100644 new mode 100755 index c56f824..994b868 --- a/ddec.py +++ b/ddec.py @@ -693,7 +693,8 @@ def send_email(message): server.starttls(context=context) # Secure the connection server.ehlo() # Can be omitted - server.login(SMTP_SENDER, SMTP_PASSWORD) + if (CLI.email_auth): + server.login(SMTP_SENDER, SMTP_PASSWORD) server.sendmail(SMTP_SENDER, CLI.email_to, message) except Exception as e: # Print any error messages to stdout @@ -809,6 +810,13 @@ def process_cli(): help="Send email via SSL (default is False)" ) parent_group.add_argument( + "-auth", + "--email-auth", + action="store_true", + default=False, + help="Send email via authenticated SMTP (default is False)" + ) + parent_group.add_argument( "-starttls", "--email-starttls", action="store_true", @@ -862,6 +870,7 @@ def print_namespase(): f"\tProxy for Telegram : {CLI.proxy}\n" f"\tEmail to : {CLI.email_to}\n" f"\tEmail SSL : {CLI.email_ssl}\n" + f"\tEmail AUTH : {CLI.email_auth}\n" f"\tEmail STARTTLS : {CLI.email_starttls}\n" f"\tUse internal whois : {use_internal_whois}\n" f"\tUse only external whois : {CLI.use_only_external_whois}\n" @@ -1336,6 +1345,11 @@ def check_cli_logic(): f"{FLR}You must specify the email address of the recipient. Use the --email_to option") sys.exit(-1) + if CLI.email_auth and (not CLI.email_to): + print( + f"{FLR}You must specify the email address of the recipient. Use the --email_to option") + sys.exit(-1) + if CLI.email_starttls and (not CLI.email_to): print( f"{FLR}You must specify the email address of the recipient. Use the --email_to option")