Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline images are listed among the attachments #379

Closed
tkoop opened this issue Oct 25, 2024 · 3 comments
Closed

Inline images are listed among the attachments #379

tkoop opened this issue Oct 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@tkoop
Copy link

tkoop commented Oct 25, 2024

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:

<img src="cid:dc94e944fb73a7d82ed7da8350333ae6@symfony" alt="image">

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").

--w9GNgkGw
Content-ID: <dc94e944fb73a7d82ed7da8350333ae6@symfony>
Content-Type: image/png; name="dc94e944fb73a7d82ed7da8350333ae6@symfony"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 name="dc94e944fb73a7d82ed7da8350333ae6@symfony"; filename=embed0.png

iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw0AcxV9TpVoqDlYo4hCkOlkQFXHUKhShQqgVWnUwufRDaNKQtLg4Cq4FBz8Wqw4uzro6uAqC
4AeIs4OToouU+L+k0CLGg+N+vLv3uHsHCPUS06yOMUDTK2YqERcz2RUx8IogIuhHN4ZkZhmzkpSE
5/i6h4+vdzGe5X3uz9Gj5iwG+ETiGWaYFeJ14qnNisF5nzjMirJKfE48atIFiR+5rrj8xrngsMAz
w2Y6NUccJhYLbay0MSuaGvEkcVTVdMoXMi6rnLc4a6Uqa96TvzCU05eXuE5zEAksYBESRCioYgMl
VBCjVSfFQor24x7+AccvkUsh1wYYOeZRhgbZ8YP/we9urfzEuJsUigOdL7b9MQwEdoFGzba/j227
cQL4n4ErveUv14HpT9JrLS16BPRuAxfXLU3ZAy53gMiTIZuyI/lpCvk88H5G35QF+m6B4KrbW3Mf
pw9AmrpK3gAHh8BIgbLXPN7d1d7bv2ea/f0AaVtyo0qcczMAAAAGYktHRAAAAAAAAPlDu38AAAAJ
cEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfoChgVGzUMtjq8AAAAGXRFWHRDb21tZW50AENyZWF0
ZWQgd2l0aCBHSU1QV4EOFwAAADtJREFUOMtjnLzJ5z8DlQATAxUBC4yR67eFbEMmb/KhvstGiGEs
6IFICOCLqNEIGKAcMBoBdMwBdHMZAFlwC77XoVD6AAAAAElFTkSuQmCC
--w9GNgkGw

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.

image

image

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".

--frmTiHh9
Content-Type: application/pdf; name="abide.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; name="abide.pdf"; filename="abide.pdf"

JVBERi0xLjQKJcfsj6IKJSVJbnZvY2F0aW9uOiBncyAtc0RFVklDRT1wZGZ3cml0ZSAtZENvbXBh
dGliaWxpdHlMZXZlbD0xLjQgLWRQREZTRVRUSU5HUz0vcHJpbnRlciAtZE5PUEFVU0UgLWRRVUlF
VCAtZEJBVENIIC1zT3V0cHV0RmlsZT0/ID8KNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVy
IC9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nH1by65syVEthISsYuBfKMmTc5DuJh+Rr6llC8wAuc2V
GGAzObhlQd2WjD8AIwb8Dp/jz2GtFZl776o6sq6660RUPiLjHZFZv7+FLd4C/83Pj2/Xv/1Vv338
4Rq2Prrlfnv94w8fP1zD7Uvbyq3GFG784z9/e/3+qpX09e+v0YH58fHt9tOvWDrG27h9/f7qu/H/
X/LWyu3rt+u/vF3+4vKz9y9hs25W29vlu/ewldhSy2+Xv+MXJbXWy9vlF+9fUi7bGIWDvvCvNDDh
X4G3vIUw3i5/rZVAcLG3yy81O46Y+9vlP9bCZlj4/h4jgIgpP7z/5us/kEhzImvoW0oNRH79t+vb
...
@tkoop
Copy link
Author

tkoop commented Oct 25, 2024

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".

image

@axllent
Copy link
Owner

axllent commented Oct 25, 2024

@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)).

@axllent axllent added the bug Something isn't working label Oct 25, 2024
@axllent
Copy link
Owner

axllent commented Nov 1, 2024

This change has been included in v1.21.1 👍 In relation to this clear(er) separation, there is also a new search filter has:inline which will filter by messages containing inline images. I'll close this issue now, but please feel free to re-open if you encounter and issues, thanks.

@axllent axllent closed this as completed Nov 1, 2024
tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Nov 21, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [axllent/mailpit](https://github.com/axllent/mailpit) | minor | `v1.20.7` -> `v1.21.4` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>axllent/mailpit (axllent/mailpit)</summary>

### [`v1.21.4`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1214)

[Compare Source](axllent/mailpit@v1.21.3...v1.21.4)

##### Bugfix

-   Fix external CSS stylesheet loading in HTML preview ([#&#8203;388](axllent/mailpit#388))

### [`v1.21.3`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1213)

[Compare Source](axllent/mailpit@v1.21.2...v1.21.3)

##### Chore

-   Update Go dependencies
-   Minor UI tweaks
-   Mute Dart Sass deprecation notices
-   Update node dependencies
-   Upgrade Alpine packages on Docker build
-   Add swagger examples & API code restructure

### [`v1.21.2`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1212)

[Compare Source](axllent/mailpit@v1.21.1...v1.21.2)

##### Feature

-   Add additional ignored flags to sendmail ([#&#8203;384](axllent/mailpit#384))

##### Chore

-   Remove legacy Tags column from message DB table
-   Update Go dependencies
-   Update node dependencies

##### Fix

-   Fix browser notification request on Edge ([#&#8203;89](axllent/mailpit#89))

### [`v1.21.1`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1211)

[Compare Source](axllent/mailpit@v1.21.0...v1.21.1)

##### Feature

-   Add ability to search by size smaller or larger than a value (eg: `larger:1M` / `smaller:2.5M`)
-   Add ability to search for messages containing inline images (`has:inline`)

##### Chore

-   Update Go dependencies
-   Separate attachments and inline images in download nav and badges ([#&#8203;379](axllent/mailpit#379))

### [`v1.21.0`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1210)

[Compare Source](axllent/mailpit@v1.20.7...v1.21.0)

##### Feature

-   Experimental Unix socket support for HTTPD & SMTPD ([#&#8203;373](axllent/mailpit#373))

##### Fix

-   Allow multiple item selection on macOS with Cmd-click  ([#&#8203;378](axllent/mailpit#378))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants