[GH-ISSUE #117] Include Message-ID in MessageSummary #78

Closed
opened 2026-03-15 12:25:34 +03:00 by kerem · 5 comments
Owner

Originally created by @Corvan on GitHub (May 29, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/117

Hey,

I found your project to be very valuable as a replacement for mailhog. For my development with Odoo at work, I wanted to have a tool with which I could test in integration tests if mail was actually sent. So I remembered mailhog found, it was abandoned and found this.
Because we are working with Python, I started to write an API client privately.

Now that I am at the point of writing test-helpers to be used by tests, I realised, that it would be nice to have the Message-ID included in the summary returned by the /messages-endpoint. Background being: if I want to test if a mail has actually been sent, I would ask the /messages-endpoint, and check for the number of messages returned. But because I cannot be sure if not more Messages were sent, I would have to get all IDs of all messages (of the last time) and then request all messages by their ID to receive their Message ID. Or could I do this with the /search-endpoint searching for the respective Message-ID?

I can get the Message-ID from a Message, that Odoo saved in its database, so I believe I would be able to write a test for Odoo, which triggers creating & sending a Message, and afterwards checking if the Message actually has been sent to mailpit.

I attempted to write a Pull Request #116, but I am not a Go developer, and I am not sure, if I found all places that would have to be changed or if I did it correctly.

Thank you for your good work!
Lars

Originally created by @Corvan on GitHub (May 29, 2023). Original GitHub issue: https://github.com/axllent/mailpit/issues/117 Hey, I found your project to be very valuable as a replacement for mailhog. For my development with [Odoo ](https://github.com/odoo/odoo) at work, I wanted to have a tool with which I could test in integration tests if mail was actually sent. So I remembered mailhog found, it was abandoned and found this. Because we are working with Python, I started to write an [API client](https://github.com/Corvan/mailpit-api-client) privately. Now that I am at the point of writing test-helpers to be used by tests, I realised, that it would be nice to have the Message-ID included in the summary returned by the `/messages`-endpoint. Background being: if I want to test if a mail has actually been sent, I would ask the `/messages`-endpoint, and check for the number of messages returned. But because I cannot be sure if not more Messages were sent, I would have to get all IDs of all messages (of the last time) and then request all messages by their ID to receive their Message ID. Or could I do this with the `/search`-endpoint searching for the respective Message-ID? I can get the Message-ID from a Message, that Odoo saved in its database, so I believe I would be able to write a test for Odoo, which triggers creating & sending a Message, and afterwards checking if the Message actually has been sent to mailpit. I attempted to write a Pull Request #116, but I am not a Go developer, and I am not sure, if I found all places that would have to be changed or if I did it correctly. Thank you for your good work! Lars
kerem closed this issue 2026-03-15 12:25:39 +03:00
Author
Owner

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

Thanks @Corvan for raising this as well as the PR, I appreciate it. I'm really busy right now, but I will definitely look into this within the next couple of days ... just letting you know so you don't think I'm ignoring you!

<!-- gh-comment-id:1567490368 --> @axllent commented on GitHub (May 29, 2023): Thanks @Corvan for raising this as well as the PR, I appreciate it. I'm **really** busy right now, but I will definitely look into this within the next couple of days ... just letting you know so you don't think I'm ignoring you!
Author
Owner

@Corvan commented on GitHub (May 29, 2023):

No hurries, thx for letting me know!

<!-- gh-comment-id:1567491234 --> @Corvan commented on GitHub (May 29, 2023): No hurries, thx for letting me know!
Author
Owner

@axllent commented on GitHub (May 30, 2023):

Great attempt, especially since you're not a Go developer :) I had to make a few corrections, and added the MessageID to the API search response and event websockets, but you were mostly there.

Or could I do this with the /search-endpoint searching for the respective Message-ID?

Actually you can (I realise now this is still undocumented) - you can actually search for message-id:<insert-id-here>, eg: message-id:122342808.1152584913901.JavaMail.j2ee@akcux155. This assumes you know the Message-ID of course, which based on your comment you already do. Either way though, message IDs are now included in the other API responses.

I've merged it in (plus those changes) and release this in v1.6.12. Thanks again for the help. Please let me know if this resolves your issue?

<!-- gh-comment-id:1567761362 --> @axllent commented on GitHub (May 30, 2023): Great attempt, especially since you're not a Go developer :) I had to make a few corrections, and added the MessageID to the API search response and event websockets, but you were mostly there. > Or could I do this with the /search-endpoint searching for the respective Message-ID? Actually you can (I realise now this is still undocumented) - you can actually search for `message-id:<insert-id-here>`, eg: `message-id:122342808.1152584913901.JavaMail.j2ee@akcux155`. This assumes you know the Message-ID of course, which based on your comment you already do. Either way though, message IDs are now included in the other API responses. I've merged it in (plus those changes) and release this in v1.6.12. Thanks again for the help. Please let me know if this resolves your issue?
Author
Owner

@Corvan commented on GitHub (May 30, 2023):

Wow, that was quick!
Thank you very much, it works now github.com/Corvan/mailpit-api-client@b8ed5c5440
But I think we forgot to include it here: https://github.com/axllent/mailpit/blob/develop/docs/apiv1/Messages.md . Would you want me to add it? In a new PR?

I am testing the API in integration tests via docker in my project as well. As soon as I have the time to transfer all the testing I am doing locally via invoke and docker-compose with containers into GitHub-Actions, maybe you'll get the possibility to adapt this for Go, if you like to ;-)

<!-- gh-comment-id:1568825240 --> @Corvan commented on GitHub (May 30, 2023): Wow, that was quick! Thank you very much, it works now https://github.com/Corvan/mailpit-api-client/commit/b8ed5c5440bc810bb79afbf1cb0068653122486d But I think we forgot to include it here: https://github.com/axllent/mailpit/blob/develop/docs/apiv1/Messages.md . Would you want me to add it? In a new PR? I am testing the API in integration tests via docker in my project as well. As soon as I have the time to transfer all the testing I am doing locally via `invoke` and `docker-compose` with containers into GitHub-Actions, maybe you'll get the possibility to adapt this for Go, if you like to ;-)
Author
Owner

@axllent commented on GitHub (May 30, 2023):

Thanks, I have just updated those API docs too. I think there's potentially a few other things missing, however since I integrated swagger documentation (eg: http://localhost:8025/api/v1/) I haven't give that much love.

I'd be interested to see how you end up integrating API testing in GitHub Actions. I'm marking this as closed as it appears to be. Thanks again for the feedback and pull request!

<!-- gh-comment-id:1569043086 --> @axllent commented on GitHub (May 30, 2023): Thanks, I have just updated those API docs too. I think there's potentially a few other things missing, however since I integrated swagger documentation (eg: `http://localhost:8025/api/v1/`) I haven't give that much love. I'd be interested to see how you end up integrating API testing in GitHub Actions. I'm marking this as closed as it appears to be. Thanks again for the feedback and pull request!
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#78
No description provided.