Re: Images in news mails
От | Jonathan S. Katz |
---|---|
Тема | Re: Images in news mails |
Дата | |
Msg-id | 29c71778-5871-4e4d-a80e-d67351c8eb4b@postgresql.org обсуждение исходный текст |
Ответ на | Images in news mails (Tobias Bussmann <t.bussmann@gmx.net>) |
Ответы |
Re: Images in news mails
|
Список | pgsql-www |
On 9/4/25 3:49 PM, Tobias Bussmann wrote: > Ever since HTML emails were introduced for project news in around 2020, I have wondered why, on my system (macOS usingApple Mail as the MUA), emails were sometimes displayed in a distorted way. Today, I took the time to track it down.Apple Mail ignores the size if the image source is provided inline via CID and not referenced externally [2, footnote3]. As a workaround, the width can be specified again in the 'style' tag, as I have done in the attached patch. > > Another issue is that the Slonik logo is displayed again at the end of the email. In contrast to the first issue, thisaffects the Mail app on iOS as well. My analysis suggests that this is caused by the MIME structure of the email: > - multipart/mixed > - multipart/alternative > - text/plain > - text/html > - image/png with Content-Disposition: inline > > This issue is resolved if I change the structure to the following: > - multipart/alternative > - text/plain > - multipart/related > - text/html > - image/png with Content-Disposition: inline > > This change could be made in the send_simple_mail() function in the pgweb/mailqueue/util.py, but it would require furthertesting and refactoring to support regular and inline attachments simultaneously. I don't feel confident enough todo this without setting up a working test system of pgweb. > An alternative solution could be to utilise the embed_images_in_html() function in pgweb/news/util.py instead of attachingthe image to the email. > > With these changes applied, the mail is displayed correctly on Apple Mail [4]. This has plagued me for years, and I'm so happy you tracked this down! The patch looks good; have you tested in a few other mail clients? I haven't had a chance to test yet. Thanks, Jonathan
Вложения
В списке pgsql-www по дате отправления: