The edX E-Commerce service uses the Communications API that is part of Oscar to create and send notifications in the form of email messages. To send notifications, you must set up notifications, create one or more email messages, and then send the email messages.
ENABLE_NOTIFICATIONS feature flag to True.COURSE_SEAT_PURCHASED to correspond to the purchase of a course seat.The E-Commerce service can send both HTML and plain text email messages. To
create an email message, create the following three files in the
ecommerce/ecommerce/templates/customer/emails/ folder.
- An HTML template that extends
email_base.htmland includes the body of the email.- A plain text file that contains the email’s subject line.
- A plain text file that contains the body of the email.
Use the following convention to name these files.
commtype_{communication type code}_body.html
For example, if the communication type code is course_seat_purchased, the
three files would have the following names.
commtype_course_seat_purchased_body.htmlcommtype_course_seat_purchased_body.txtcommtype_course_seat_purchased_subject.txtNote
To add a custom email body, override block body in the email_base.html
file. To add a custom footer, override block footer in the email_base.html
file.
To send email messages, use the send_notification(user, commtype_code,
context) method. This method is implemented in
ecommerce/ecommerce/notifications/notifications.py.