( jur - nay - sic ) Entrepreneur / Software Engineer

Sending HTML Emails In Django-Registration

I have been working on a project that uses django-registration for registering our users. This allows us to make sure that they have given a valid email address, and to some extent helps to prevent bots on the system.

One of the things that we want to do is make things easy for our users, but the checked out version of django-registration only sends text emails which requires the user to manually copy and paste the registration link in their browser. Not very user friendly for users that are not as well versed in computers or mobile platforms. So I went about fixing this myself.

To do this, I found an article at StackOverflow. Essentially the answer is just to follow the standard Django method of attaching an HTML version to the text version of the email. The StackOverflow question just confirmed that there was no way to do this without modifying the source for django-registration, which is not ideal, but oh well.

So do this, modify models.py function send_activation_email:

Thank you for registering with {{ site }}.

Go to http://{{ site.domain }}{% url registration_activate activation_key %} activate your account.

Your account will expire in {{ expiration_days }} days unless you activate it.

Below you will find a zip of my new models.py file as well as the template for my activation email.

Follow Us

Follow our activity on the web and get to know us.