Tuesday, February 21, 2012

Re: email - inline image

Thx Tom,

as you guess I have already googled quite a lot. > 5hours.
My search was kind of "django inline image email" and subcultures.
And I actually found some techniques ... but I guess your approach is
best.

I did not know that the magic chain I am looking for is "django mime
multipart email".

So for all future searchers:
If you are interested in "django email inline image" or "django email
embedded image" please search for "django mime multipart email".
http://stackoverflow.com/questions/1633109/creating-a-mime-email-template-with-images-to-send-with-python-django

Thank you very much Tom!

Kind regards,
ionic


On Tue, 2012-02-21 at 13:49 +0000, Tom Evans wrote:
> On Tue, Feb 21, 2012 at 12:42 PM, ionic drive <ionicdrive@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment