ImportError: cannot import name EmailMessage

1,438 views
Skip to first unread message

laspal

unread,
Sep 18, 2008, 2:23:33 AM9/18/08
to Django users
Hi,
I am using 0.96 version of django and I am not able to import
EmailMessage.
I have to send attachment with the mail and for that I am using
EmailMessage but not able to import it.
Does any one has a idea how to do it.

here is my code:
if emailform.is_valid():
subject = emailform.clean_data['subject']
message = emailform.clean_data['message']
attach = request.FILES['attach']
try:
mail = EmailMessage(subject, message, sender,
mailing_list)
mail.attach(attach.name, attach.read(),
attach.content_type)
mail.send()
#send_mail(subject, message, sender, mailing_list)

Thanks

Malcolm Tredinnick

unread,
Sep 18, 2008, 2:24:31 AM9/18/08
to django...@googlegroups.com

On Wed, 2008-09-17 at 23:23 -0700, laspal wrote:
> Hi,
> I am using 0.96 version of django and I am not able to import
> EmailMessage.
> I have to send attachment with the mail and for that I am using
> EmailMessage but not able to import it.
> Does any one has a idea how to do it.

EmailMessage did not exist in Django 0.96.

Regards,
Malcolm


laspal

unread,
Sep 18, 2008, 2:49:06 AM9/18/08
to Django users
So is there any way of attachment to mail using send_mail() in 0.96
version

On Sep 18, 11:24 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:

Malcolm Tredinnick

unread,
Sep 18, 2008, 2:51:34 AM9/18/08
to django...@googlegroups.com

On Wed, 2008-09-17 at 23:49 -0700, laspal wrote:
> So is there any way of attachment to mail using send_mail() in 0.96
> version

No. You'll have to use Python's mail classes manually. The send_mail()
and send_mass_mail() functions are only for very simple things.

Regards,
Malcolm


Reply all
Reply to author
Forward
0 new messages