I don't know about the specifics of your particular issues, but to
send HTML emails:
Create an instance of django.core.mail.EmailMultiAlternatives, passing
in your subject, text version of the email, from address, list of
recipients. Render your HTML version of the email, and attach it to
the email, and then send it.
eg:
from django.core.mail import EmailMultiAlternatives
msg = EmailMultiAlternatives('Subject', 'This is the text version',
'fr...@address.com', [ 'recip...@address.com',])
html_version = ...
msg.attach_alternative(html_version, 'text/html')
msg.send()
There are lots of 'gotchas' when sending HTML email. Don't expect
externally referenced resources to be available, don't expect styles
to work correctly in all UAs, don't expect any JS to work.
Cheers
Tom
On Tue, Nov 2, 2010 at 9:07 AM, andy <flow...@gmail.com> wrote:
> I recently tried to send the following in a test password email from a
> site I am creating:
>
> <h1>This is a test reset password email.</h1>
>
> However when I received the email it displayed the "<h1>This is a test
> reset password email.</h1>".
>
> My question is how can I send a styled email using html tags and
> possibly even css when using the password_reset_email.html template
> that goes with django's view.password_reset?
>I don't know about the specifics of your particular issues, but to
send HTML emails:Create an instance of django.core.mail.EmailMultiAlternatives, passing
in your subject, text version of the email, from address, list of
recipients. Render your HTML version of the email, and attach it to
the email, and then send it.eg:
from django.core.mail import EmailMultiAlternatives
msg = EmailMultiAlternatives('Subject', 'This is the text version',
'fr...@address.com', [ 'recip...@address.com',])
html_version = ...
msg.attach_alternative(html_version, 'text/html')
msg.send()