Fix html mail as plain text bug
This commit is contained in:
parent
635933e32c
commit
5b4fe02f86
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.core.mail import get_connection, send_mail
|
from django.core.mail import get_connection, send_mail
|
||||||
|
from django.utils.html import strip_tags
|
||||||
|
|
||||||
from core.settings import EMAIL_HOST, EMAIL_PORT, EMAIL_USE_SSL, EMAIL_USE_TLS
|
from core.settings import EMAIL_HOST, EMAIL_PORT, EMAIL_USE_SSL, EMAIL_USE_TLS
|
||||||
|
|
||||||
@ -15,7 +16,8 @@ def realm_send_mail(realm, to, subject, message):
|
|||||||
use_ssl=EMAIL_USE_SSL,
|
use_ssl=EMAIL_USE_SSL,
|
||||||
use_tls=EMAIL_USE_TLS)
|
use_tls=EMAIL_USE_TLS)
|
||||||
send_mail(subject=subject,
|
send_mail(subject=subject,
|
||||||
message=message,
|
message=strip_tags(message),
|
||||||
|
html_message=message,
|
||||||
from_email=realm.email,
|
from_email=realm.email,
|
||||||
recipient_list=[to, ],
|
recipient_list=[to, ],
|
||||||
connection=connection)
|
connection=connection)
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
<h1>Willkommen bei den StuVe Services, {{ user.username }}!</h1>
|
<h1>Willkommen bei den StuVe Services, {{ user.username }}!</h1>
|
||||||
<p>Es wurde ein Account für dich angelegt.</p>
|
<p>Es wurde ein Account für dich angelegt.</p>
|
||||||
<p>Dein Nutzername lautet: {{ user.username }}</p>
|
<p><strong>Dein Nutzername lautet:</strong> {{ user.username }}</p>
|
||||||
<p>Uns ist folgende E-Mail bekannt: {{ email }}</p>
|
<p><strong>Uns ist folgende E-Mail bekannt:</strong> {{ email }}</p>
|
||||||
<p>Um deinen Account zu aktivieren</p>
|
<p>Über den folgenden Link kannst du deinen Account aktivieren:
|
||||||
<p>Über den folgenden Link kannst du deinen Account
|
<a href="{{ protocol }}://
|
||||||
aktivieren: {{ protocol }}://{{ domain }}{{ url('ldap_password_reset_confirm', kwargs={'uidb64':uid, 'token':token}) }}</p>
|
{{ domain }}{{ url('ldap_password_reset_confirm', kwargs={'uidb64':uid, 'token':token}) }}">
|
||||||
<p>Der Link ist nur {{ expiration_days }} Tage gültig!</p>
|
{{ protocol }}://{{ domain }}{{ url('ldap_password_reset_confirm', kwargs={'uidb64':uid, 'token':token}) }}#
|
||||||
<p>Und so erreichst du deinen Account: {{ protocol }}://{{ domain }}{{ url('login') }}</p>
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>Der Link ist nur <strong>{{ expiration_days }} Tage</strong> gültig!</p>
|
||||||
|
<p>Und so gehts zum <a href="{{ protocol }}://{{ domain }}{{ url('login') }}">Login</a></p>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user