views:

877

answers:

1

Hi guys, im using django-registration, all is fine, the confirmation email was sending in plain text, but know im fixed and is sending in html, but i have a litter problem... the html code is showing:

<a href="http://www.example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/"&gt;http://www. example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/</a>

and i dont need to show the html code like the ...

Any idea?

Thanks

+6  A: 

I'd recommend sending both a text version and an html version. Look in the models.py of the django-registration for :

send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [self.user.email])

and instead do something like from the docs http://docs.djangoproject.com/en/dev/topics/email/#sending-alternative-content-types

from django.core.mail import EmailMultiAlternatives

subject, from_email, to = 'hello', '[email protected]', '[email protected]'
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>important</strong> message.</p>'
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
Paul Tarjan
Yes Paul, thans for replay, but is not working i did in that way and nothing...but now is ok :) , now just a put the link without <a ...
Asinox
That will send a text email that some clients will create links for. If you ever need more interesting html, you will have to do what I recommended.
Paul Tarjan
yes, i tryed but dont work, but is ok :) ill try a litter more :)
Asinox
What was your error? I do this in my django-registration
Paul Tarjan