# Sending emails with edx-ace via Tutor plugin

**URL:** <https://discuss.openedx.org/t/sending-emails-with-edx-ace-via-tutor-plugin/13269>\
**Category:** Tutor Help\
**Created:** [June 25, 2024, 1:49pm UTC](https://discuss.openedx.org/t/sending-emails-with-edx-ace-via-tutor-plugin/13269 "2024-06-25T13:49:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![haha](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@haha](https://discuss.openedx.org/u/haha)\
**Post date:** [June 25, 2024, 1:49pm UTC](https://discuss.openedx.org/t/sending-emails-with-edx-ace-via-tutor-plugin/13269/1 "2024-06-25T13:49:38Z")

</div>

I’m looking to send users an email notification via a custom backend Django app we have installed as a Tutor plugin.

I’ve added edx-ace to the plugin and can trigger an email, however edx-ace complains about not being able to find the templates.

Here is the stacktrace:

```auto
2024-06-19 12:02:25 Traceback (most recent call last):
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
2024-06-19 12:02:25 response = get_response(request)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
2024-06-19 12:02:25 response = wrapped_callback(request, *callback_args, **callback_kwargs)
2024-06-19 12:02:25 File "/opt/pyenv/versions/3.8.15/lib/python3.8/contextlib.py", line 75, in inner
2024-06-19 12:02:25 return func(*args, **kwds)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
2024-06-19 12:02:25 return view_func(*args, **kwargs)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
2024-06-19 12:02:25 return self.dispatch(request, *args, **kwargs)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
2024-06-19 12:02:25 response = self.handle_exception(exc)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
2024-06-19 12:02:25 self.raise_uncaught_exception(exc)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
2024-06-19 12:02:25 raise exc
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
2024-06-19 12:02:25 response = handler(request, *args, **kwargs)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/generics.py", line 190, in post
2024-06-19 12:02:25 return self.create(request, *args, **kwargs)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 19, in create
2024-06-19 12:02:25 self.perform_create(serializer)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 24, in perform_create
2024-06-19 12:02:25 serializer.save()
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 205, in save
2024-06-19 12:02:25 self.instance = self.create(validated_data)
2024-06-19 12:02:25 File "/openedx/requirements/my-app/my_app/serializers.py", line 154, in create
2024-06-19 12:02:25 send_cohort_membership_invite(cohort_membership)
2024-06-19 12:02:25 File "/openedx/requirements/my-app/my_app/messages.py", line 35, in send_cohort_membership_invite
2024-06-19 12:02:25 send_message(msg)
2024-06-19 12:02:25 File "/openedx/requirements/my-app/my_app/messages.py", line 20, in send_message
2024-06-19 12:02:25 ace.send(msg)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/edx_ace/ace.py", line 52, in send
2024-06-19 12:02:25 rendered_message = presentation.render(channel, msg)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/edx_ace/presentation.py", line 25, in render
2024-06-19 12:02:25 return renderer.render(channel, message)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/edx_ace/renderers.py", line 43, in render
2024-06-19 12:02:25 template = self.get_template_for_message(channel, message, filename)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/edx_ace/renderers.py", line 63, in get_template_for_message
2024-06-19 12:02:25 return loader.get_template(template_path)
2024-06-19 12:02:25 File "/openedx/venv/lib/python3.8/site-packages/django/template/loader.py", line 19, in get_template
2024-06-19 12:02:25 raise TemplateDoesNotExist(template_name, chain=chain)
2024-06-19 12:02:25 django.template.exceptions.TemplateDoesNotExist: my_app/edx_ace/invite/email/from_name.txt

```

The Django app and email template files are structured as:

```auto
/my-app
  ...
  /my_app
    ...
    /edx_ace
      /invite
        /email
          ...
          from_name.txt
          ...

```

Does anyone have experience with this that might be able to help point me in the right direction?

Thanks!

---

<div class="post-metadata">

**Author:** ![haha](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@haha](https://discuss.openedx.org/u/haha)\
**Post date:** [July 17, 2024, 3:21pm UTC](https://discuss.openedx.org/t/sending-emails-with-edx-ace-via-tutor-plugin/13269/2 "2024-07-17T15:21:48Z")

</div>

I was able to get around the exception by moving the template files to the installed & activated theme’s templates directory, e.g,

```auto
/openedx
  /requirements
    /my-app
      ...
      /my_app
  ...
  /themes
    /my-theme
      /lms
        /templates
          ...
          /my_app
            /edx_ace
              /invite
                /email

```

This isn’t the most desirable solution, however. And I’m not yet sure how to test the email locally.

Perhaps there is a way to modify where `edx-ace` looks for templates via a Tutor plugin so I can include them within in the Django plugin app (`/openedx/requirements/my-app/my_app`)?
