About images in mail.sent

43 views
Skip to first unread message

António Ramos

unread,
Oct 21, 2022, 11:59:35 AM10/21/22
to web...@googlegroups.com, py4web
Coding like in the manual 
mail.send('y...@example.com',
  'Message subject',
  '<html><img src="cid:photo" /></html>',
  attachments = mail.Attachment('/path/to/photo.jpg', content_id='photo'))


all the images appear at the bottom of the email as attachments like this ( anexos means attachments!)
image.png



how do i prevent this because its not nice to see them as attachments besides the <html><img src="cid:photo" /></html>'

regards
António

Massimo

unread,
Oct 23, 2022, 2:34:26 PM10/23/22
to py4web
I do not know if it is possible. The email client decides how to display the images.

Ron McOuat

unread,
Oct 26, 2022, 12:46:13 AM10/26/22
to py4web
Using Thunderbird I added an inline image to an email to myself, saved the received email to a file and opened it in a text editor.

The html part of the message looked like this:

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Image inline<img src="cid:part1.yqKN0...@gmail.com"
        moz-do-not-send="false"><br>
    </p>
  </body>
</html>

The part1.yqKN0...@gmail.com is a following section containing base64 encoding of the image.
The "Image inline" is just text I put in the message before adding inline the image. The "moz-do-not-send=false" is just a processing flag for Thunderbird. I sent a second email with the image inline and added as an attachment and this text was no longer there.
Maybe it needs a head and body section to function as a correct html email. Just trying to help by using an email client to manufacture a message of the type you want to send.

Regards,
Ron

Massimo DiPierro

unread,
Oct 26, 2022, 1:57:53 AM10/26/22
to Ron McOuat, py4web
i misread your previous email. this is not the browser image preview as i assumed. the book example adds the <img ...> to explicitly embed images of in the <html/>

simply delete any reference to the image in the body of the email. the attachments=... is sufficient.


--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/32080211-f6fe-419d-8cda-15d156f701abn%40googlegroups.com.

Massimo

unread,
Oct 26, 2022, 4:03:37 AM10/26/22
to py4web
Basically you just want this:

mail.send('y...@example.com', 'Message subject', '<html>Body message</html>', attachments = [mail.Attachment('/path/to/photo.jpg', content_id='photo')])
Reply all
Reply to author
Forward
0 new messages