Send 'text/html' send_mass_mail

228 views
Skip to first unread message

Marinho Brandao

unread,
Jun 7, 2007, 8:43:50 PM6/7/07
to django-d...@googlegroups.com
Hello all,

I have notice some users (like me) need for 'text/html' mime-type in
sendmail (and send_mass_mail, of course), some tickets treats this
subject.

I solved this problem, replacing the following line (78) in
django.core.mail module:

msg = SafeMIMEText(message, 'plain', settings.DEFAULT_CHARSET)

by this (using a new setting, called DEFAULT_EMAIL_MIMETYPE:

mime_type = settings.DEFAULT_EMAIL_MIMETYPE or 'plain'
msg = SafeMIMEText(message, mime_type, settings.DEFAULT_CHARSET)

I notice that the not yet official version, in SVN, haves a new
paradigm, through the class EmailMessage, by the method message(self),
but there is the same problem.

What do you think about my solution?

--
José Mário, Mário ou Marinho

http://del.icio.us/marinho
http://www.flickr.com/photos/marinho/
http://marinho.wordpress.com

Russell Keith-Magee

unread,
Jun 7, 2007, 9:08:37 PM6/7/07
to django-d...@googlegroups.com
On 6/8/07, Marinho Brandao <mar...@gmail.com> wrote:
>
> Hello all,
>
> I have notice some users (like me) need for 'text/html' mime-type in
> sendmail (and send_mass_mail, of course), some tickets treats this
> subject.

This is the subject of ticket #3605; it has been discussed a few
times, but there has been some argument as to whether this should be
included. Search the archives for the discussions.

Yours,
Russ Magee %-)

Malcolm Tredinnick

unread,
Jun 7, 2007, 9:13:57 PM6/7/07
to django-d...@googlegroups.com

I started ploughing through all the email tickets a while back and then
switched to unicode work, but I should get back to them. I got about
halfway through all of them, from memory.

Reading the notes I made about the earlier discussions, there was no
strong consensus on this item and I was going to add easier support for
multipart messages and then close #3605 because that would provide a way
to send HTML email whilst also encouraging best practice (including a
plain text version).

Anybody who doesn't want that exact behaviour will, of course, still be
able to send their email using Python's direct support or by overriding
the EmailMessage class. Gary Wilson's work to make the mail support more
object-oriented really helps cases like that: we avoid having to cater
to every use-case by making ourselves more extensible.

Regards,
Malcolm


Reply all
Reply to author
Forward
0 new messages