I\'m trying to send email with some images attached in django. Code used is this snippet : http://www.djangosnippets.org/snippets/1063/. Dunno why the attachment part return
The error traceback you've posted doesn't seem to have anything to do with the actual code - it seems to be some sort of problem with middleware (presumably when rendering the 500 error page).
However, your error is probably caused by your use of the undefined variable name attach in the calls to mail.attach. You don't have an attach variable - you've called the posted files image1 etc, so you should use those names.
mail.attach(image1.name, image1.read(), image1.content_type)
mail.attach(image2.name, image2.read(), image2.content_type)
mail.attach(image3.name, image3.read(), image3.content_type)