Commit 68513407 by Waheed Ahmed

Merge pull request #3978 from edx/waheed/lms2734-added-logging-for-email

Added logging for sender email address on BotoServerError.
parents 7beaf4ed 200394f6
......@@ -1260,7 +1260,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
else:
user.email_user(subject, message, from_address)
except Exception: # pylint: disable=broad-except
log.warning('Unable to send activation email to user', exc_info=True)
log.error('Unable to send activation email to user from "{from_address}"'.format(from_address=from_address), exc_info=True)
js['value'] = _('Could not send activation e-mail.')
# What is the correct status code to use here? I think it's 500, because
# the problem is on the server's end -- but also, the account was created.
......@@ -1584,7 +1584,7 @@ def reactivation_email_for_user(user):
try:
user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
except Exception: # pylint: disable=broad-except
log.warning('Unable to send reactivation email', exc_info=True)
log.error('Unable to send reactivation email from "{from_address}"'.format(from_address=settings.DEFAULT_FROM_EMAIL), exc_info=True)
return JsonResponse({
"success": False,
"error": _('Unable to send reactivation email')
......@@ -1658,8 +1658,14 @@ def change_email_request(request):
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)
try:
send_mail(subject, message, from_address, [pec.new_email])
except Exception: # pylint: disable=broad-except
log.error('Unable to send email activation link to user from "{from_address}"'.format(from_address=from_address), exc_info=True)
return JsonResponse({
"success": False,
"error": _('Unable to send email activation link. Please try again later.')
})
return JsonResponse({"success": True})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment