Using the Django email backend¶
The user notify client library ships with an email backend suitable for use in Django applications. This page covers how to configure that backend.
Add the library as a dependency¶
Follow the installation instructions in the getting started
guide but for the Django backend to be available you
will need to install the library as ucam_user_notify[django].
Add email settings¶
Configure the backend with the following Django settings. For example:
# Use the User Notify email backend.
EMAIL_BACKEND = "ucam_user_notify.django.UserNotifyEmailBackend"
# The service id as registered with the User Notify service.
USER_NOTIFY_SERVICE_ID = "punt-booker"
# We set the default "From" email to None so that the From address registered in
# the User Notify service is used. You can customise it if you want but the From
# address must match one of those registered with the service.
DEFAULT_FROM_EMAIL = None
Emails sent using Django's send_email function should now go through the User Notify service.