Commit 1ad4a2fa authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP] (csbackntfy): only use login mechanism if username is set

parent 5e86fffd
...@@ -329,8 +329,7 @@ def main(argv=None): ...@@ -329,8 +329,7 @@ def main(argv=None):
if 0 == len(host): if 0 == len(host):
raise Usage("Hostname missing.", eCodes.GLOBAL_UsageError) raise Usage("Hostname missing.", eCodes.GLOBAL_UsageError)
if 0 == len(username): if 0 != len(username):
raise Usage("Username missing.", eCodes.GLOBAL_UsageError)
if 0 == len(password): if 0 == len(password):
raise Usage("Password missing.", eCodes.GLOBAL_UsageError) raise Usage("Password missing.", eCodes.GLOBAL_UsageError)
if -1 == port: if -1 == port:
...@@ -400,6 +399,7 @@ def main(argv=None): ...@@ -400,6 +399,7 @@ def main(argv=None):
if useTLS: if useTLS:
session.starttls() session.starttls()
session.ehlo() session.ehlo()
if 0 != len(username):
session.login(username, password) session.login(username, password)
session.sendmail(sender, receivers, mail.as_string()) session.sendmail(sender, receivers, mail.as_string())
except smtplib.SMTPRecipientsRefused: except smtplib.SMTPRecipientsRefused:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment