Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4bbeaf32
Commit
4bbeaf32
authored
Sep 02, 2016
by
attiyaishaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECOM-5281 Add retires for email sending while registering.
parent
45e243da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
cms/envs/test.py
+3
-0
common/djangoapps/student/views.py
+26
-15
lms/envs/common.py
+3
-0
No files found.
cms/envs/test.py
View file @
4bbeaf32
...
@@ -335,3 +335,6 @@ INSTALLED_APPS += ('openedx.core.djangoapps.api_admin',)
...
@@ -335,3 +335,6 @@ INSTALLED_APPS += ('openedx.core.djangoapps.api_admin',)
# Set the default Oauth2 Provider Model so that migrations can run in
# Set the default Oauth2 Provider Model so that migrations can run in
# verbose mode
# verbose mode
OAUTH2_PROVIDER_APPLICATION_MODEL
=
'oauth2_provider.Application'
OAUTH2_PROVIDER_APPLICATION_MODEL
=
'oauth2_provider.Application'
# Used with Email sending
RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS
=
5
common/djangoapps/student/views.py
View file @
4bbeaf32
...
@@ -1791,21 +1791,32 @@ def create_account_with_params(request, params):
...
@@ -1791,21 +1791,32 @@ def create_account_with_params(request, params):
'email_from_address'
,
'email_from_address'
,
settings
.
DEFAULT_FROM_EMAIL
settings
.
DEFAULT_FROM_EMAIL
)
)
try
:
retries
=
settings
.
RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS
if
settings
.
FEATURES
.
get
(
'REROUTE_ACTIVATION_EMAIL'
):
while
retries
:
dest_addr
=
settings
.
FEATURES
[
'REROUTE_ACTIVATION_EMAIL'
]
try
:
message
=
(
"Activation for
%
s (
%
s):
%
s
\n
"
%
(
user
,
user
.
email
,
profile
.
name
)
+
if
settings
.
FEATURES
.
get
(
'REROUTE_ACTIVATION_EMAIL'
):
'-'
*
80
+
'
\n\n
'
+
message
)
dest_addr
=
settings
.
FEATURES
[
'REROUTE_ACTIVATION_EMAIL'
]
mail
.
send_mail
(
subject
,
message
,
from_address
,
[
dest_addr
],
fail_silently
=
False
)
message
=
(
"Activation for
%
s (
%
s):
%
s
\n
"
%
(
user
,
user
.
email
,
profile
.
name
)
+
else
:
'-'
*
80
+
'
\n\n
'
+
message
)
user
.
email_user
(
subject
,
message
,
from_address
)
mail
.
send_mail
(
subject
,
message
,
from_address
,
[
dest_addr
],
fail_silently
=
False
)
except
Exception
:
# pylint: disable=broad-except
else
:
log
.
error
(
user
.
email_user
(
subject
,
message
,
from_address
)
u'Unable to send activation email to user from "
%
s" to "
%
s"'
,
# Log that the Activation Email has been sent to user without an exception
from_address
,
log
.
info
(
"Activataion Email has been sent to User {user_email}"
.
format
(
dest_addr
,
user_email
=
dest_addr
exc_info
=
True
))
)
break
except
Exception
:
# pylint: disable=broad-except
retries
-=
1
if
retries
<=
0
:
break
log
.
error
(
u'Unable to send activation email to user from "
%
s" to "
%
s"'
,
from_address
,
dest_addr
,
exc_info
=
True
)
else
:
else
:
registration
.
activate
()
registration
.
activate
()
_enroll_user_in_pending_courses
(
user
)
# Enroll student in any pending courses
_enroll_user_in_pending_courses
(
user
)
# Enroll student in any pending courses
...
...
lms/envs/common.py
View file @
4bbeaf32
...
@@ -370,6 +370,9 @@ GENERATE_PROFILE_SCORES = False
...
@@ -370,6 +370,9 @@ GENERATE_PROFILE_SCORES = False
# Used with XQueue
# Used with XQueue
XQUEUE_WAITTIME_BETWEEN_REQUESTS
=
5
# seconds
XQUEUE_WAITTIME_BETWEEN_REQUESTS
=
5
# seconds
# Used with Email sending
RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS
=
5
############################# SET PATH INFORMATION #############################
############################# SET PATH INFORMATION #############################
PROJECT_ROOT
=
path
(
__file__
)
.
abspath
()
.
dirname
()
.
dirname
()
# /edx-platform/lms
PROJECT_ROOT
=
path
(
__file__
)
.
abspath
()
.
dirname
()
.
dirname
()
# /edx-platform/lms
...
...
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