[GH-ISSUE #175] Display email previews #119

Closed
opened 2026-03-15 12:41:22 +03:00 by kerem · 16 comments
Owner

Originally created by @IgnisDa on GitHub (Sep 29, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/175

Hello I am not sure if this feature already exists but is it possible to display the email's preview?

Here is how gmail displays it:
Screenshot

Here is what mailpit shows:
image

Originally created by @IgnisDa on GitHub (Sep 29, 2023). Original GitHub issue: https://github.com/axllent/mailpit/issues/175 Hello I am not sure if this feature already exists but is it possible to display the email's preview? Here is how gmail displays it: ![Screenshot](https://github.com/axllent/mailpit/assets/60938164/4ab820c0-38e2-4918-a4ec-27ae704a9155) Here is what mailpit shows: ![image](https://github.com/axllent/mailpit/assets/60938164/79cc6e13-cc93-4852-86da-c13d80756762)
kerem 2026-03-15 12:41:22 +03:00
Author
Owner

@IgnisDa commented on GitHub (Sep 29, 2023):

Also, @axllent, I want to thank you for writing such a useful and beautiful software. I am using mailpit after a long time (I used it before about a year ago) and the number of features and polish that has been added to mailpit since then is impressive.

<!-- gh-comment-id:1740812994 --> @IgnisDa commented on GitHub (Sep 29, 2023): Also, @axllent, I want to thank you for writing such a useful and beautiful software. I am using mailpit after a long time (I used it before about a year ago) and the number of features and polish that has been added to mailpit since then is impressive.
Author
Owner

@axllent commented on GitHub (Sep 29, 2023):

Thanks for the kind words @IgnisDa. A lot of work has gone into developing Mailpit - a lot more than I originally though & planned, but then again, it has far more features than I had originally planned too due to its popularity and user requests :)

This snippet feature is currently technically not possible as that "snippet data" isn't stored in a way that is quick to extract without being be too CPU & database intensive. That doesn't mean it can't be implemented though as a new "database field", but it would require a number of internal changes first, as well as some web UI changes to accommodate for this.

As you may have noticed, Gmail displays the subject and snippet on one line (truncated based on screen width), which allows them to "squash" in a lot of information per line. Everything is however bunched onto one line, the downside being that both the sender/receiver information is very limited, and the subject line itself can get truncated. I chose to rather display the sender/receiver & subject information in full as it is far more useful for testing. It already takes up two lines though and including a snippet would only make this more (especially when using tags).

Anyway... I can look into this (no promises!), but I'd first like to know why you would like this feature, as in what purpose would it serve you for testing?

<!-- gh-comment-id:1741460602 --> @axllent commented on GitHub (Sep 29, 2023): Thanks for the kind words @IgnisDa. A lot of work has gone into developing Mailpit - a lot more than I originally though & planned, but then again, it has far more features than I had originally planned too due to its popularity and user requests :) This snippet feature is currently technically not possible as that "snippet data" isn't stored in a way that is quick to extract without being be too CPU & database intensive. That doesn't mean it can't be implemented though as a new "database field", but it would require a number of internal changes first, as well as some web UI changes to accommodate for this. As you may have noticed, Gmail displays the subject and snippet on one line (truncated based on screen width), which allows them to "squash" in a lot of information per line. Everything is however bunched onto one line, the downside being that both the sender/receiver information is very limited, and the subject line itself can get truncated. I chose to rather display the sender/receiver & subject information in full as it is far more useful for testing. It already takes up two lines though and including a snippet would only make this more (especially when using tags). Anyway... I can look into this (no promises!), but I'd first like to know why you would like this feature, as in what purpose would it serve you for testing?
Author
Owner

@IgnisDa commented on GitHub (Sep 29, 2023):

I want it so that I can avoid problems like this in production:
image

(There was a problem with how I was rendering the preview text and since preview does not show up in mailpit, I caught this problem only when I checked the mail in production.

<!-- gh-comment-id:1741586560 --> @IgnisDa commented on GitHub (Sep 29, 2023): I want it so that I can avoid problems like this in production: ![image](https://github.com/axllent/mailpit/assets/60938164/ef2963e3-18f5-4e15-88e7-a1f0ed34782a) (There was a problem with how I was rendering the preview text and since preview does not show up in mailpit, I caught this problem only when I checked the mail in production.
Author
Owner

@axllent commented on GitHub (Oct 4, 2023):

@IgnisDa I'm working on this feature at the moment but have gotten to a point where I'm not sure in which direction to go. Snippets in something like Gmail are based on multiple factors. Sometimes it takes the content from the text part, other times from the HTML part - it seems to depend on many factors, including who the sender is. For instance, all Github emails use the HTML version, however Mailchimp messages use the text version (which appears to have a "intro" line of text). There is no standard way of doing this either that I'm aware of.

This [object object] "thing" you experienced was being displayed on what platform, and where was that [object object] snippet originating from? Was it the HTML content [object object], the text content, or both?

<!-- gh-comment-id:1746101752 --> @axllent commented on GitHub (Oct 4, 2023): @IgnisDa I'm working on this feature at the moment but have gotten to a point where I'm not sure in which direction to go. Snippets in something like Gmail are based on multiple factors. Sometimes it takes the content from the text part, other times from the HTML part - it seems to depend on many factors, including who the sender is. For instance, all Github emails use the HTML version, however Mailchimp messages use the text version (which appears to have a "intro" line of text). There is no standard way of doing this either that I'm aware of. This `[object object]` "thing" you experienced was being displayed on what platform, and where was that `[object object]` snippet originating from? Was it the HTML content `[object object]`, the text content, or both?
Author
Owner

@IgnisDa commented on GitHub (Oct 4, 2023):

The [object object] was a bug on my part. It does not matter here. What I want is just to see the email preview. I would prefer it be shown using the same rules that popular email clients use to determine what the "preview" is.

However, I think there may be no standard to determine what a preview is. In that case, I would personally just like to see whatever this component renders.

I will leave the choice up to you :).

<!-- gh-comment-id:1746112752 --> @IgnisDa commented on GitHub (Oct 4, 2023): The `[object object]` was a bug on my part. It does not matter here. What I want is just to see the email preview. I would prefer it be shown using the same rules that popular email clients use to determine what the "preview" is. However, I think there may be no standard to determine what a preview is. In that case, I would personally just like to see whatever [this](https://react.email/docs/components/preview) component renders. I will leave the choice up to you \:).
Author
Owner

@axllent commented on GitHub (Oct 4, 2023):

I haven't a clue what that component renders as it appears to just display whatever is passed to it (prop), but I think you've answered my question as best you can. I'll do a bit more digging and get something released in the near future.

<!-- gh-comment-id:1746516519 --> @axllent commented on GitHub (Oct 4, 2023): I haven't a clue what that component renders as it appears to just display whatever is passed to it (prop), but I think you've answered my question as best you can. I'll do a bit more digging and get something released in the near future.
Author
Owner

@IgnisDa commented on GitHub (Oct 4, 2023):

I'm not sure what to make of it, but here's the source code https://github.com/resendlabs/react-email/blob/main/packages/preview/src/preview.tsx.

<!-- gh-comment-id:1746603741 --> @IgnisDa commented on GitHub (Oct 4, 2023): I'm not sure what to make of it, but here's the source code https://github.com/resendlabs/react-email/blob/main/packages/preview/src/preview.tsx.
Author
Owner

@axllent commented on GitHub (Oct 5, 2023):

I have just released v1.9.5 which includes this feature. The release notes explain how to re-index existing messages as the snippets are only created when new messages are received. Let me know what you think?

<!-- gh-comment-id:1748024847 --> @axllent commented on GitHub (Oct 5, 2023): I have just released [v1.9.5](https://github.com/axllent/mailpit/releases/tag/v1.9.5) which includes this feature. The release notes explain how to re-index existing messages as the snippets are only created when new messages are received. Let me know what you think?
Author
Owner

@IgnisDa commented on GitHub (Oct 5, 2023):

Functionally it works as expected, but I would prefer that the entire preview be shown:
image

(for the second email)

<!-- gh-comment-id:1748050128 --> @IgnisDa commented on GitHub (Oct 5, 2023): Functionally it works as expected, but I would prefer that the entire preview be shown: ![image](https://github.com/axllent/mailpit/assets/60938164/fa4eff48-00ac-440a-ab6e-9ae929a24b24) (for the second email)
Author
Owner

@axllent commented on GitHub (Oct 5, 2023):

What do you mean by "the entire preview" for the second email, and are you meaning the message at the top or the bottom? At the moment it uses line-clamp which means the content actually wraps normally, but it'll only show the first line (so after "for your account" there must be a long word what would have wrapped naturally on the next line"). I could probably change this to regular CSS truncation which would extend it to the end of the line (ie: no wrapping), but it depends again on what you mean by "entire preview".

<!-- gh-comment-id:1748067324 --> @axllent commented on GitHub (Oct 5, 2023): What do you mean by "the entire preview" for the second email, and are you meaning the message at the top or the bottom? At the moment it uses `line-clamp` which means the content actually wraps normally, but it'll only show the first line (so after "for your account" there must be a long word what would have wrapped naturally on the next line"). I could probably change this to regular CSS truncation which would extend it to the end of the line (ie: no wrapping), but it depends again on what you mean by "entire preview".
Author
Owner

@IgnisDa commented on GitHub (Oct 5, 2023):

I would like that the entire text for "Enter the..." be visible. Maybe it would be better if it was under the subject?

<!-- gh-comment-id:1748116613 --> @IgnisDa commented on GitHub (Oct 5, 2023): I would like that the entire text for "Enter the..." be visible. Maybe it would be better if it was under the subject?
Author
Owner

@axllent commented on GitHub (Oct 5, 2023):

I would like that the entire text for "Enter the..." be visible. Maybe it would be better if it was under the subject?

The entire snippet is currently 200 characters. This can be very problematic as that is dependent on quite a few variables; viewport size (screen size, mobile view etc), length of subject, etc. I've looked at Gmail, Yahoo and Outlook and they all truncate the subject & snippet on one line (probably for the same reason). The second line is "reserved" (used) for displaying tags.

I've just tried both what you suggest, and the regular text truncate:

Screenshot 2023-10-05 at 19-20-40 Mailpit - localhost

vs:

Screenshot 2023-10-05 at 19-23-26 Mailpit - localhost

I'm in two minds at the moment which way to go. Whilst I can see the benefits of showing more of the snippet, it takes up an extra line of space, making it all much more "busy". Your thoughts?

<!-- gh-comment-id:1748167439 --> @axllent commented on GitHub (Oct 5, 2023): > I would like that the entire text for "Enter the..." be visible. Maybe it would be better if it was under the subject? The entire snippet is currently 200 characters. This can be very problematic as that is dependent on quite a few variables; viewport size (screen size, mobile view etc), length of subject, etc. I've looked at Gmail, Yahoo and Outlook and they all truncate the subject & snippet on one line (probably for the same reason). The second line is "reserved" (used) for displaying tags. I've just tried both what you suggest, and the regular text truncate: ![Screenshot 2023-10-05 at 19-20-40 Mailpit - localhost](https://github.com/axllent/mailpit/assets/1463435/5f6c96c7-6cb1-4b53-bb19-56e6e98cb89c) vs: ![Screenshot 2023-10-05 at 19-23-26 Mailpit - localhost](https://github.com/axllent/mailpit/assets/1463435/5989d764-7702-4d12-8ef5-f062b7afdcfc) I'm in two minds at the moment which way to go. Whilst I can see the benefits of showing more of the snippet, it takes up an extra line of space, making it all much more "busy". Your thoughts?
Author
Owner

@IgnisDa commented on GitHub (Oct 5, 2023):

Personally I would prefer the first since i would like to see the entire preview (or whatever other email clients show). But i do agree with it feeling cluttered.

Maybe the best way to go forward is a setting for having previews on the second line (default being on the same line)?

Personally I don't use the tags feature of mailpit so clutter it not really an issue to me.

<!-- gh-comment-id:1748180249 --> @IgnisDa commented on GitHub (Oct 5, 2023): Personally I would prefer the first since i would like to see the entire preview (or whatever other email clients show). But i do agree with it feeling cluttered. Maybe the best way to go forward is a setting for having previews on the second line (default being on the same line)? Personally I don't use the tags feature of mailpit so clutter it not really an issue to me.
Author
Owner

@axllent commented on GitHub (Oct 6, 2023):

You win - I took a small "survey" at work to get a sense of what others felt, and they agreed with you :-) I have just released v1.9.6 for this 👍

<!-- gh-comment-id:1749961784 --> @axllent commented on GitHub (Oct 6, 2023): You win - I took a small "survey" at work to get a sense of what others felt, and they agreed with you :-) I have just released [v1.9.6](https://github.com/axllent/mailpit/releases/tag/v1.9.6) for this :+1:
Author
Owner

@antonkomarev commented on GitHub (Oct 6, 2023):

I'd vote for the first one too.

<!-- gh-comment-id:1749968886 --> @antonkomarev commented on GitHub (Oct 6, 2023): I'd vote for the first one too.
Author
Owner

@IgnisDa commented on GitHub (Oct 6, 2023):

You win - I took a small "survey" at work to get a sense of what others felt, and they agreed with you :-) I have just released v1.9.6 for this 👍

Awesome, it works well for me. Thanks for the prompt turnover!

<!-- gh-comment-id:1749974904 --> @IgnisDa commented on GitHub (Oct 6, 2023): > You win - I took a small "survey" at work to get a sense of what others felt, and they agreed with you :-) I have just released [v1.9.6](https://github.com/axllent/mailpit/releases/tag/v1.9.6) for this 👍 Awesome, it works well for me. Thanks for the prompt turnover!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#119
No description provided.