Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Frost
proto3
Commits
cdbc3061
Commit
cdbc3061
authored
Oct 10, 2017
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Set Reply-To for todo and protocol mails
parent
6cc4f81d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tasks.py
+12
-7
12 additions, 7 deletions
tasks.py
utils.py
+3
-1
3 additions, 1 deletion
utils.py
with
15 additions
and
8 deletions
tasks.py
+
12
−
7
View file @
cdbc3061
...
...
@@ -579,10 +579,14 @@ def send_reminder_async(reminder_id, protocol_id):
reminder_text
=
render_template
(
"
reminder-mail.txt
"
,
reminder
=
reminder
,
protocol
=
protocol
)
if
reminder
.
send_public
:
print
(
"
sending public reminder mail to {}
"
.
format
(
protocol
.
protocoltype
.
public_mail
))
send_mail
(
protocol
,
protocol
.
protocoltype
.
public_mail
,
"
Tagesordnung der {}
"
.
format
(
protocol
.
protocoltype
.
name
),
reminder_text
)
send_mail
(
protocol
,
protocol
.
protocoltype
.
public_mail
,
"
Tagesordnung der {}
"
.
format
(
protocol
.
protocoltype
.
name
),
reminder_text
,
reply_to
=
protocol
.
protocoltype
.
public_mail
)
if
reminder
.
send_private
:
print
(
"
sending private reminder mail to {}
"
.
format
(
protocol
.
protocoltype
.
private_mail
))
send_mail
(
protocol
,
protocol
.
protocoltype
.
private_mail
,
"
Tagesordnung der {}
"
.
format
(
protocol
.
protocoltype
.
name
),
reminder_text
)
send_mail
(
protocol
,
protocol
.
protocoltype
.
private_mail
,
"
Tagesordnung der {}
"
.
format
(
protocol
.
protocoltype
.
name
),
reminder_text
,
reply_to
=
protocol
.
protocoltype
.
private_mail
)
def
send_protocol_private
(
protocol
):
send_protocol_async
.
delay
(
protocol
.
id
,
show_private
=
True
)
...
...
@@ -640,18 +644,19 @@ def send_todomails_async(protocol_id):
continue
to_addr
=
todomail
.
get_formatted_mail
()
mail_content
=
render_template
(
"
todo-mail.txt
"
,
protocol
=
protocol
,
todomail
=
todomail
,
todos
=
grouped_todos
[
user
])
send_mail
(
protocol
,
to_addr
,
subject
,
mail_content
)
send_mail
(
protocol
,
to_addr
,
subject
,
mail_content
,
reply_to
=
protocol
.
protocoltype
.
private_mail
)
def
send_mail
(
protocol
,
to_addr
,
subject
,
content
,
appendix
=
None
):
def
send_mail
(
protocol
,
to_addr
,
subject
,
content
,
appendix
=
None
,
reply_to
=
None
):
if
to_addr
is
not
None
and
len
(
to_addr
.
strip
())
>
0
:
send_mail_async
.
delay
(
protocol
.
id
,
to_addr
,
subject
,
content
,
appendix
)
send_mail_async
.
delay
(
protocol
.
id
,
to_addr
,
subject
,
content
,
appendix
,
reply_to
)
@celery.task
def
send_mail_async
(
protocol_id
,
to_addr
,
subject
,
content
,
appendix
):
def
send_mail_async
(
protocol_id
,
to_addr
,
subject
,
content
,
appendix
,
reply_to
):
with
app
.
app_context
():
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
try
:
mail_manager
.
send
(
to_addr
,
subject
,
content
,
appendix
)
mail_manager
.
send
(
to_addr
,
subject
,
content
,
appendix
,
reply_to
)
except
Exception
as
exc
:
error
=
protocol
.
create_error
(
"
Sending Mail
"
,
"
Sending mail failed
"
,
str
(
exc
))
db
.
session
.
add
(
error
)
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
3
−
1
View file @
cdbc3061
...
...
@@ -75,7 +75,7 @@ class MailManager:
self
.
use_tls
=
getattr
(
config
,
"
MAIL_USE_TLS
"
,
True
)
self
.
use_starttls
=
getattr
(
config
,
"
MAIL_USE_STARTTLS
"
,
False
)
def
send
(
self
,
to_addr
,
subject
,
content
,
appendix
=
None
):
def
send
(
self
,
to_addr
,
subject
,
content
,
appendix
=
None
,
reply_to
=
None
):
if
(
not
self
.
active
or
not
self
.
hostname
or
not
self
.
from_addr
):
...
...
@@ -85,6 +85,8 @@ class MailManager:
msg
[
"
To
"
]
=
to_addr
msg
[
"
Subject
"
]
=
subject
msg
[
"
Message-ID
"
]
=
"
<{}@{}>
"
.
format
(
uuid4
(),
getfqdn
())
if
reply_to
is
not
None
:
msg
[
"
Reply-To
"
]
=
reply_to
msg
.
attach
(
MIMEText
(
content
,
_charset
=
"
utf-8
"
))
if
appendix
is
not
None
:
for
name
,
file_like
in
appendix
:
...
...
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
sign in
to comment