[pfx] Re: Detect/extract attachments in broken messages composed by Apple Mail

2023-05-26 Thread Bill Cole via Postfix-users

On 2023-05-26 at 07:05:09 UTC-0400 (Fri, 26 May 2023 13:05:09 +0200)
Paul Menzel via Postfix-users 
is rumored to have said:


Dear Postfix folks,


Apple Mail violates the standard [1],


That's no "standard" that's a Mozilla Inc. bug report.

There is no violation of standards here, there is only an *uncommon* 
MIME structure.



resulting in attachments only being shown in the HTML view.


How your MUA presents a particular MIME structure is implementation 
dependent.


E.g. my MUA shows me a message with attachments as having attachments, 
whether it is rendering HTML or not, no matter which part of a 
multipart/alternative message it is presenting. That's a MUA design 
choice.



This behaviour is to be expected given the incorrect MIME structure
of the message. It is:

multipart/alternative
  text/plain
  multipart/mixed
text/html
attachment

So when selecting the plain part, you don't see the attachment
associated with the alternative part.


As Viktor noted, this CAN be a legitimate choice. If the "attachments" 
are images that only exist to be displayed inline in rendered HTML, 
there's no point in trying to present them in a MNUA that only displays 
the text/plain part.



The message structure should be:

multipart/mixed
  multipart/alternative
text/plain
text/html
  attachment


If we wanted to detect such messages, and add a notification or 
extract the attachment, what component would be the right part for 
such message alteration? A milter?


A milter would be the best choice. Both MIMEDefang and MailMunge (a 
descendant of MIMEDefang) could do this, if you can work with the Perl 
MIME::Tools module.




(I am aware, that this will break with end-to-end encryption (GPG or 
S/MIME).)


It will also break DKIM. Therefore it would be unsuccessful if you were 
to do this with mail that you want to relay or forward elsewhere.




--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org


[pfx] Re: Detect/extract attachments in broken messages composed by Apple Mail

2023-05-26 Thread Viktor Dukhovni via Postfix-users
On Fri, May 26, 2023 at 01:05:09PM +0200, Paul Menzel via Postfix-users wrote:

> > This behaviour is to be expected given the incorrect MIME structure
> > of the message. It is:
> > 
> > multipart/alternative
> >   text/plain
> >   multipart/mixed
> > text/html
> > attachment

Note that sometimes the "attachment" in question is specifically related
to the HTML part (an image referenced from the HTML or similar).  And
though in principle the enclosing multipart should then be a
"multipart/related", I suspect that might not always be the case in
pratice.

> > So when selecting the plain part, you don't see the attachment
> > associated with the alternative part.
> > 
> > The message structure should be:
> > 
> > multipart/mixed
> >   multipart/alternative
> > text/plain
> > text/html
> >   attachment
> 
> If we wanted to detect such messages, and add a notification or extract 
> the attachment, what component would be the right part for such message 
> alteration? A milter?

Perhaps "altermime" could do this (though I am sceptical).  You'd
probably need to write a milter specifically for this (PyMilter).

Is this a compelling problem?  Perhaps it should be fixed on the
sender's end.

-- 
Viktor.
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org


[pfx] Detect/extract attachments in broken messages composed by Apple Mail

2023-05-26 Thread Paul Menzel via Postfix-users

Dear Postfix folks,


Apple Mail violates the standard [1], resulting in attachments only 
being shown in the HTML view.



This behaviour is to be expected given the incorrect MIME structure
of the message. It is:

multipart/alternative
  text/plain
  multipart/mixed
text/html
attachment

So when selecting the plain part, you don't see the attachment
associated with the alternative part.

The message structure should be:

multipart/mixed
  multipart/alternative
text/plain
text/html
  attachment


If we wanted to detect such messages, and add a notification or extract 
the attachment, what component would be the right part for such message 
alteration? A milter?


(I am aware, that this will break with end-to-end encryption (GPG or 
S/MIME).)



Kind regards,

Paul


[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1362539#c3
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org