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,10 +329,9 @@ def main(argv=None): ...@@ -329,10 +329,9 @@ 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:
raise Usage("Port missing.", eCodes.GLOBAL_UsageError) raise Usage("Port missing.", eCodes.GLOBAL_UsageError)
# prepare email # prepare email
...@@ -400,7 +399,8 @@ def main(argv=None): ...@@ -400,7 +399,8 @@ def main(argv=None):
if useTLS: if useTLS:
session.starttls() session.starttls()
session.ehlo() session.ehlo()
session.login(username, password) if 0 != len(username):
session.login(username, password)
session.sendmail(sender, receivers, mail.as_string()) session.sendmail(sender, receivers, mail.as_string())
except smtplib.SMTPRecipientsRefused: except smtplib.SMTPRecipientsRefused:
session.quit() session.quit()
......
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