mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-27 01:06:01 +03:00
[GH-ISSUE #175] Display email previews #119
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#119
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:

Here is what mailpit shows:

@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.
@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?
@IgnisDa commented on GitHub (Sep 29, 2023):
I want it so that I can avoid problems like this in production:

(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.
@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?@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 :).
@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.
@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.
@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?
@IgnisDa commented on GitHub (Oct 5, 2023):
Functionally it works as expected, but I would prefer that the entire preview be shown:

(for the second email)
@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-clampwhich 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".@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?
@axllent commented on GitHub (Oct 5, 2023):
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:
vs:
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?
@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.
@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 👍
@antonkomarev commented on GitHub (Oct 6, 2023):
I'd vote for the first one too.
@IgnisDa commented on GitHub (Oct 6, 2023):
Awesome, it works well for me. Thanks for the prompt turnover!