On Tue, Feb 21, 2012 at 12:42 PM, ionic drive <ionicdr...@gmail.com> wrote: > Hello djangos, > > I want to add a *.jpg image to an html-formated/email signature. > > I am not sure if this approach is correct, please help: > > image_file = open(settings.PROJECT_ROOT+'/static/images/image_name.jpg', > 'rb') #get the image file > msg_image = > MIMEImage(image_file.read()) > #with proper MIME type > image_file.close() > msg.attach(msg_image) > #attach the image to the mail message. > > so far so good: > the image gets sent with the email message and is attached as > "attachment.dat". > > How can I reference this image now to see it appear inline in the mail > message!? > > <IMG SRC="???/image_name.jpg" ALIGN="bottom" BORDER="0"> > > Please improve my code... > why is the image recognized as "attachment.dat" and not with proper > image_name??? > > Is this the right approach to send a signature with inline image? > > Thanks for your help guys > ionic > >
You should really try to STFW before asking questions like this. You aren't the first person to want to do this. http://stackoverflow.com/questions/1633109/creating-a-mime-email-template-with-images-to-send-with-python-django This was the fifth link on a search for "django mime multipart email". Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.