Open tkoop opened 4 days ago
Also note this. On the home page, the paper clip icon does show up correctly, only when disposition is "attachment", not when it is "inline".
@tkoop Thanks for the details. You are correct, there is a discrepancy between the message list attachment indicator (paper clip) and the message view (Attachment (1)
) which I will fix.
Backstory: Unfortunately there are actually huge discrepancies between mail clients, mainly in the generation of messages containing inline images. A number of clients do not actually use the Content-Disposition: inline;
/ Content-ID
attributes - they just attach the file (like a regular attachment) and reference the filename as <img src="cid:<filename>" />
. Because of this, many (most?) clients support displaying inline images even when they are attachments (and so does Mailpit).
Originally I catered for this in Mailpit by referring to both attachments and inline images as "attachments" in the web UI as well as the search, however that is wrong and at some point I decided this was a bad idea and changed it to the current behaviour. But, as you pointed out, there is still one artefact from that (...in the current versions of Mailpit, you're using an older version < v1.20.0 based on hour screenshots) - that being the Attachment (1)
in the message view in your screenshot.
I need to give this a little more thought as to whether I just exclude inline images from that count, or whether I add a new Inline (1)
tag to the message view (eg: a message with one attachment and two inline images could show Attachment (1)
and Inlines (2)
).
If an email has an image in it with a disposition of "inline", it shows up in Mailpit as an attachment. The UI will say there is an attachment, but there isn't really.
Other email clients don't consider "inline" files to be attachments, so they shouldn't show up in Mailpit as attachments either.
For example, the html of the email may contain an inline png, like this:
When it does, there should also be a file included that matches the cid ("Content-id"), like this. (Also notice the Content-Disposition is "inline").
When this happens, the web UI shows this as an attachment, but it shouldn't. No other email client considers files like this to be attachments, so Mailpit shouldn't either.
If we really like the idea of listing all included files in the email, we should at least differentiate between attached files and inline files. Perhaps we could have two lists: a list of "Attachments", and a list of all "Included Files".
For the sake of completeness, this is what an actual attachment looks like. Notice the value of "Content-Disposition".