SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
9ae0217b
Commit
9ae0217b
authored
8 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Modify email facility: use one connection for group emails
parent
24060a0f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
journals/templates/journals/journals.html
+1
-0
1 addition, 0 deletions
journals/templates/journals/journals.html
scipost/views.py
+20
-11
20 additions, 11 deletions
scipost/views.py
with
21 additions
and
11 deletions
journals/templates/journals/journals.html
+
1
−
0
View file @
9ae0217b
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
</div>
</div>
</div>
</div>
<p>
Research-level didactic material in all domains and subject areas of Physics.
</p>
<p>
Research-level didactic material in all domains and subject areas of Physics.
</p>
<p
style=
"color: red;"
>
Open for submission!
</p>
<br/>
<br/>
<hr
class=
"hr6"
>
<hr
class=
"hr6"
>
<div
class=
"flex-container"
>
<div
class=
"flex-container"
>
...
...
This diff is collapsed.
Click to expand it.
scipost/views.py
+
20
−
11
View file @
9ae0217b
...
@@ -12,6 +12,7 @@ from django.contrib.auth.decorators import login_required
...
@@ -12,6 +12,7 @@ from django.contrib.auth.decorators import login_required
from
django.contrib.auth.models
import
User
,
Group
,
Permission
from
django.contrib.auth.models
import
User
,
Group
,
Permission
from
django.contrib.auth.views
import
password_reset
,
password_reset_confirm
from
django.contrib.auth.views
import
password_reset
,
password_reset_confirm
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.core
import
mail
from
django.core.mail
import
EmailMessage
from
django.core.mail
import
EmailMessage
from
django.core.paginator
import
Paginator
,
EmptyPage
,
PageNotAnInteger
from
django.core.paginator
import
Paginator
,
EmptyPage
,
PageNotAnInteger
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
...
@@ -902,17 +903,25 @@ def email_group_members(request):
...
@@ -902,17 +903,25 @@ def email_group_members(request):
if
request
.
method
==
'
POST
'
:
if
request
.
method
==
'
POST
'
:
form
=
EmailGroupMembersForm
(
request
.
POST
)
form
=
EmailGroupMembersForm
(
request
.
POST
)
if
form
.
is_valid
():
if
form
.
is_valid
():
recipient_emails
=
[]
# recipient_emails = []
for
member
in
form
.
cleaned_data
[
'
group
'
].
user_set
.
all
():
# for member in form.cleaned_data['group'].user_set.all():
recipient_emails
.
append
(
member
.
email
)
# recipient_emails.append(member.email)
emailmessage
=
EmailMessage
(
# emailmessage = EmailMessage(
form
.
cleaned_data
[
'
email_subject
'
],
# form.cleaned_data['email_subject'],
form
.
cleaned_data
[
'
email_text
'
],
# form.cleaned_data['email_text'],
'
SciPost Admin <admin@scipost.org>
'
,
# 'SciPost Admin <admin@scipost.org>',
[
'
admin@scipost.org
'
],
# ['admin@scipost.org'],
bcc
=
recipient_emails
,
# bcc=recipient_emails,
reply_to
=
[
'
admin@scipost.org
'
])
# reply_to=['admin@scipost.org'])
emailmessage
.
send
(
fail_silently
=
False
)
# emailmessage.send(fail_silently=False)
with
mail
.
get_connection
()
as
connection
:
for
member
in
form
.
cleaned_data
[
'
group
'
].
user_set
.
all
():
email_text
=
(
'
Dear
'
+
title_dict
[
member
.
contributor
.
title
]
+
'
'
+
member
.
last_name
+
'
,
\n\n
'
+
form
.
cleaned_data
[
'
email_text
'
])
mail
.
EmailMessage
(
form
.
cleaned_data
[
'
email_subject
'
],
email_text
,
'
SciPost Admin <admin@scipost.org>
'
,
[
member
.
email
],
connection
=
connection
).
send
()
context
=
{
'
ack_header
'
:
'
The email has been sent.
'
,
context
=
{
'
ack_header
'
:
'
The email has been sent.
'
,
'
followup_message
'
:
'
Return to your
'
,
'
followup_message
'
:
'
Return to your
'
,
'
followup_link
'
:
reverse
(
'
scipost:personal_page
'
),
'
followup_link
'
:
reverse
(
'
scipost:personal_page
'
),
...
...
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