Python Forum
An email with inline jpg cannot be read by all email clients
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An email with inline jpg cannot be read by all email clients
#1
I'm writing a simple script to send email with inline picture in Python 3.5; because I'm a beginner I take the example on the official doc: 19.1.14.1. Examples using the Provisional API

Well, the generated email can be correctly read by Thunderbird but not on other email clients like Apple Mail and Gmail web based email.

Comparing the same message (with the same attachment) it seems that the inline attachment is encoded differently.

On the example, only the line:

with open("roasted-asparagus.jpg", 'rb') as img:
    msg.get_payload()[1].add_related(img.read(), 'image', 'jpeg', cid=asparagus_cid)
...should make the magic to read the jpg and encode it properly.

Anybody with similar experiences and / or suggestions?

There is a complete Python high level library to correctly handle the building and sending of emails with attachments? The built in library (smtplib) seems too much low level... in PHP there is PHPMailer: Something similar in Python?

Thanks for answer.

Francesco
Reply


Messages In This Thread
An email with inline jpg cannot be read by all email clients - by fpiraneo - Feb-23-2018, 05:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sound Sensor With EMail Notification parascand 1 537 Dec-10-2023, 03:10 AM
Last Post: deanhystad
  Save image from outlook email cubangt 1 754 Jun-07-2023, 06:52 PM
Last Post: cubangt
  Sent email based on if condition stewietopg 1 925 Mar-15-2023, 08:54 AM
Last Post: menator01
  How to horizontally align and display images side-by-side in an email using Python? shantanu97 0 1,033 Feb-22-2023, 11:41 PM
Last Post: shantanu97
  Looking to automate updating a spreadsheet with image from email cubangt 2 1,036 Feb-14-2023, 03:43 PM
Last Post: cubangt
Question Email and TLS only, how ? SpongeB0B 1 1,058 Feb-06-2023, 02:09 PM
Last Post: SpongeB0B
  Send email with smtp without using Mimetext mgallotti 0 739 Feb-01-2023, 04:43 AM
Last Post: mgallotti
  Get sender of email Pedroski55 0 1,641 Dec-03-2022, 09:23 AM
Last Post: Pedroski55
  is it possible to copy image from email and place into excel file? cubangt 3 1,328 Nov-30-2022, 05:11 PM
Last Post: snippsat
  email Library: properly send message as quoted-printable malonn 3 1,416 Nov-14-2022, 09:31 PM
Last Post: malonn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020