开发者

django-registration Email Customizations

开发者 https://www.devze.com 2023-03-05 18:37 出处:网络
I am using django-registration, and have two questions with regards to customizing the email sent after a user has requested to reset his password.

I am using django-registration, and have two questions with regards to customizing the email sent after a user has requested to reset his password.

This开发者_JAVA百科 is what I currently have in password_reset_email.html:

{% load i18n %}
{% blocktrans %} Please click the link below to change your password:
{% endblocktrans %}

{% block reset_link %}{{ domain }}{% url auth_password_reset_confirm uidb36=uid, token=token %}

Thanks,
Mysite
{% endblock %}

And in my settings.py:

DEFAULT_FROM_EMAIL = 'Mysite'

I have two questions --

1) Currently the email is from Mysite, with return address 'Mysite'. How do I make it so it appears as Mysite, but the return address is 'Mysite@no-reply.com'?

2) Currently the subject of the email says 'Password reset on Mysite'How/where do I change the subject of the reset-password email?


1) You should change your email setting to DEFAULT_FROM_EMAIL = 'Mysite <Mysite@no-reply.com>'

2) The last I checked, this was not changeable. django-registration has the subject line hardcoded.

EDIT: Correction: The password reset subject line is set by Django's PasswordResetFormnot django-registration.


You can change the subject of the email in your <...>templates/registration/activation_email_subject.txt

Make sure that file exists, then put in it whatever you want.

Also, your email should be "no-reply@mysite.com" instead of mysite@no-replay.com.

0

精彩评论

暂无评论...
验证码 换一张
取 消