Hi.
.... what is "attach"? It is StringIO object. And these objects don't have
a name attribute.
try this:
mail.attach('mypdfname.pdf', attach.get_value(), 'application/pdf')
HTH,
Thomas
laspal schrieb:
> ok I can use cStringIO for it but my real problem is how to attach
> file in emailmessage??
>
> response = HttpResponse(mimetype='application/pdf')
> response['Content-Disposition'] = 'attachment;
> filename=report1.pdf'
> buffer = StringIO()
> p = canvas.Canvas(buffer)
> pdf = buffer.getvalue()
> buffer.close()
> response.write(pdf)
> -------------------------------------
> attach = pdf
> mail = EmailMessage(subject, message, sender,[send_to])
> mail.attach(attach.name, attach.read(), attach.content_type)
> mail.send()
>
> this will give me error saying object has no attribute 'name'.
>
>
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---