-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Feature request: search (filter) emails by created (delivery) date #252
Comments
I must admit that I've toyed with this idea a number of times in the past, however I keep getting stuck. The issue is time zones.... Mailpit will use whatever timezone it is using on the server, and all dates/times returned via the API include the timezone used, however when it comes to querying, there is no guarantee the client is even in the same timezone as that set (or not set) on the Mailpit server. It works in Gmail because Google knows your timezone (you're logged in), but that's not the case in Mailpit. The only reliable way I can think of is if the before/after queries would be fully formatted datetimes including timezone, which users will not get right, so I'm not sure the best approach here. Suggestions? |
You're right. Using server time zone or fully formatted datetime is ok from API perspective. But from user and UI perspective - it's not user-friendly. As I can see, local user time zone is used to show time on the UI, so it's expected that user will use local time zone when quering from UI. mailpit/server/ui-src/mixins/CommonMixins.js Lines 47 to 49 in bfd5837
But so far I don't see any ideas other than passing the local timezone of the user in requests. Maybe here or in
With moment-timezone - https://momentjs.com/timezone/docs/#/using-timezones/guessing-user-timezone/ |
I think this could work - the browser's timezone could possibly get passed as an (optional) API parameter for searches. Accurate browser timezone detection is not entirely reliable though, so I can predict some complications though. Then there is the date & time parsing on the Go/API side - it's not nearly as flexible as something like PHP's Tell me, how useful would date+time-based filtering really be for you (forgetting for the moment date filtering which I still plan to add)? I understand your use case, but is there not any other option that could possibly help resolve this for you, for instance applying message tags? Surely if you are facing an issue whereby multiple servers (or CI processes) may be testing at the same time, then you still have the risk of time-based searches conflicting too? Could you maybe add a unique tag to the message as it was saved which would give you something far more accurate to filter by (a random number, hostname, commit hash etc.)? I am busy adding the ability for "plus addressing" ( |
Or alternatively generate a unique message ID for your emails, that way you definitely could filter by something accurate.... |
This issue is stale because it has been open for 14 days with no activity. |
Apologies for the long wait, but this is just to let you know that I have released v1.16.0 which has support for The timezone was a tricky one so I have had to add another optional API parameter to the search endpoint called |
Mailpit already implements a lot of useful filters, but it lacks of filter by email delivery date + time.
Example query from Gmail:
after:2024/2/26 before:2024/2/29
(there's no time).Use case: we use Mailpit for integration testing and in some cases there may be very similar emails with dynamically generated content, so we can't easily match it.
As a workaround it's possible to use "search" endpoint and filter by
Created
on client side, but it would be great to support native filter.The text was updated successfully, but these errors were encountered: