Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
c891012f
Commit
c891012f
authored
6 years ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Use library-provided methods to generate Message-ID header
parent
0b81e059
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils.py
+4
-3
4 additions, 3 deletions
utils.py
with
4 additions
and
3 deletions
utils.py
+
4
−
3
View file @
c891012f
...
...
@@ -7,12 +7,11 @@ import smtplib
from
email.mime.multipart
import
MIMEMultipart
from
email.mime.text
import
MIMEText
from
email.mime.application
import
MIMEApplication
from
email.utils
import
make_msgid
from
datetime
import
datetime
import
requests
from
io
import
BytesIO
import
ipaddress
from
socket
import
getfqdn
from
uuid
import
uuid4
import
subprocess
import
contextlib
...
...
@@ -59,6 +58,8 @@ class MailManager:
self
.
password
=
getattr
(
config
,
"
MAIL_PASSWORD
"
,
""
)
self
.
use_tls
=
getattr
(
config
,
"
MAIL_USE_TLS
"
,
True
)
self
.
use_starttls
=
getattr
(
config
,
"
MAIL_USE_STARTTLS
"
,
False
)
# if SERVER_NAME is empty, we already have problems elsewhere
self
.
msgid_domain
=
getattr
(
config
,
"
SERVER_NAME
"
)
def
_get_smtp
(
self
):
if
self
.
use_tls
:
...
...
@@ -88,7 +89,7 @@ class MailManager:
msg
[
"
From
"
]
=
self
.
from_addr
msg
[
"
To
"
]
=
to_addr
msg
[
"
Subject
"
]
=
subject
msg
[
"
Message-ID
"
]
=
"
<{}@{}>
"
.
format
(
uuid4
(),
getfqdn
()
)
msg
[
"
Message-ID
"
]
=
make_msgid
(
idstring
=
"
proto3
"
,
domain
=
self
.
msgid_domain
)
if
reply_to
is
not
None
:
msg
[
"
Reply-To
"
]
=
reply_to
msg
.
attach
(
MIMEText
(
content
,
_charset
=
"
utf-8
"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment