Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bd1094a4
Commit
bd1094a4
authored
Dec 06, 2009
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging: Improved support for SMTP over TLS.
parent
48305667
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Lib/logging/handlers.py
Lib/logging/handlers.py
+8
-5
No files found.
Lib/logging/handlers.py
View file @
bd1094a4
...
@@ -810,7 +810,7 @@ class SMTPHandler(logging.Handler):
...
@@ -810,7 +810,7 @@ class SMTPHandler(logging.Handler):
A handler class which sends an SMTP email for each logging event.
A handler class which sends an SMTP email for each logging event.
"""
"""
def
__init__
(
self
,
mailhost
,
fromaddr
,
toaddrs
,
subject
,
def
__init__
(
self
,
mailhost
,
fromaddr
,
toaddrs
,
subject
,
credentials
=
None
,
secure
=
Fals
e
):
credentials
=
None
,
secure
=
Non
e
):
"""
"""
Initialize the handler.
Initialize the handler.
...
@@ -819,8 +819,11 @@ class SMTPHandler(logging.Handler):
...
@@ -819,8 +819,11 @@ class SMTPHandler(logging.Handler):
(host, port) tuple format for the mailhost argument. To specify
(host, port) tuple format for the mailhost argument. To specify
authentication credentials, supply a (username, password) tuple
authentication credentials, supply a (username, password) tuple
for the credentials argument. To specify the use of a secure
for the credentials argument. To specify the use of a secure
protocol (TLS), pass in True for the secure argument. This will
protocol (TLS), pass in a tuple for the secure argument. This will
only be used when authentication credentials are supplied.
only be used when authentication credentials are supplied. The tuple
will be either an empty tuple, or a single-value tuple with the name
of a keyfile, or a 2-value tuple with the names of the keyfile and
certificate file. (This tuple is passed to the `starttls` method).
"""
"""
logging
.
Handler
.
__init__
(
self
)
logging
.
Handler
.
__init__
(
self
)
if
isinstance
(
mailhost
,
tuple
):
if
isinstance
(
mailhost
,
tuple
):
...
@@ -888,9 +891,9 @@ class SMTPHandler(logging.Handler):
...
@@ -888,9 +891,9 @@ class SMTPHandler(logging.Handler):
self
.
getSubject
(
record
),
self
.
getSubject
(
record
),
formatdate
(),
msg
)
formatdate
(),
msg
)
if
self
.
username
:
if
self
.
username
:
if
self
.
secure
:
if
self
.
secure
is
not
None
:
smtp
.
ehlo
()
smtp
.
ehlo
()
smtp
.
starttls
()
smtp
.
starttls
(
*
self
.
secure
)
smtp
.
ehlo
()
smtp
.
ehlo
()
smtp
.
login
(
self
.
username
,
self
.
password
)
smtp
.
login
(
self
.
username
,
self
.
password
)
smtp
.
sendmail
(
self
.
fromaddr
,
self
.
toaddrs
,
msg
)
smtp
.
sendmail
(
self
.
fromaddr
,
self
.
toaddrs
,
msg
)
...
...
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