Skip to content

Commit

Permalink
chore: added debug logs in instructor enrolment email (#36250)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhtishamShahid authored Feb 13, 2025
1 parent a8a8ae3 commit c9dfb6e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lms/djangoapps/instructor/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.translation import override as override_language
from edx_ace import ace
from edx_ace import ace, presentation
from edx_ace.channel.django_email import DjangoEmailChannel
from edx_ace.recipient import Recipient
from eventtracking import tracker
from submissions import api as sub_api # installed from the edx-submissions repository
Expand Down Expand Up @@ -591,6 +592,19 @@ def send_mail_to_student(student, param_dict, language=None):
user_context=param_dict,
)

render_msg = presentation.render(DjangoEmailChannel, message)
if not render_msg.body_html.count(student):
log.error(
{
'message': 'Email template does not contain required email address',
'email_address': student,
'message_type': message_type,
'render_msg': render_msg.body,
'count': render_msg.body_html.count(student),
'lms_user_id': lms_user_id,
**param_dict
}
)
ace.send(message)


Expand Down

0 comments on commit c9dfb6e

Please sign in to comment.