public inbox for pgsql-www@postgresql.org
help / color / mirror / Atom feedFrom: Jonathan S. Katz <jkatz@postgresql.org>
To: Tobias Bussmann <t.bussmann@gmx.net>
To: pgsql-www@lists.postgresql.org
Subject: Re: Images in news mails
Date: Fri, 5 Sep 2025 14:23:16 -0400
Message-ID: <29c71778-5871-4e4d-a80e-d67351c8eb4b@postgresql.org> (raw)
In-Reply-To: <99A6E7C8-1634-4162-96FD-D5AC404ADBCF@gmx.net>
References: <99A6E7C8-1634-4162-96FD-D5AC404ADBCF@gmx.net>
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 using Apple 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, footnote 3]. 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, this affects 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 further testing and refactoring to support regular and inline attachments simultaneously. I don't feel confident enough to do 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 attaching the 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
Attachments:
[application/pgp-signature] OpenPGP_signature.asc (840B, 2-OpenPGP_signature.asc)
download
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-www@postgresql.org
Cc: jkatz@postgresql.org, t.bussmann@gmx.net, pgsql-www@lists.postgresql.org
Subject: Re: Images in news mails
In-Reply-To: <29c71778-5871-4e4d-a80e-d67351c8eb4b@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox