Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
csback
Commits
1ad4a2fa
Commit
1ad4a2fa
authored
Sep 01, 2015
by
thomas.forbriger
Browse files
[WP] (csbackntfy): only use login mechanism if username is set
parent
5e86fffd
Changes
1
Hide whitespace changes
Inline
Side-by-side
csbackntfy.py
View file @
1ad4a2fa
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment