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

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

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