Interface MailpitClient
Declarative HTTP client for the Mailpit API v1.
- Since:
- 3.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionDeletes messages.deleteSearch(String query, @Nullable String timezone) Deletes messages matching a search.Deletes a tag from all messages.getChaos()Gets current chaos trigger settings.getInfo()Gets application information and mailbox totals.getMessage(String id) Gets a message and marks it read.Gets message headers.io.micronaut.http.HttpResponse<byte[]> getMessagePart(String id, String partId) Gets a message attachment or inline part.io.micronaut.http.HttpResponse<byte[]> getMessagePartThumbnail(String id, String partId) Gets an attachment image thumbnail.getRawMessage(String id) Gets a message's raw source.getTags()Gets all current tags.Gets web UI configuration.Runs Mailpit's HTML compatibility check for a message.Runs Mailpit's link check for a message.listMessages(@Nullable Integer start, @Nullable Integer limit) Lists mailbox messages from newest to oldest.releaseMessage(String id, MailpitReleaseMessageRequest request) Releases a message through Mailpit's configured SMTP relay.renameTag(String tag, MailpitRenameTagRequest request) Renames a tag.renderHtml(String id, @Nullable String embed) Renders the message HTML part.renderText(String id) Renders the message text part.Searches messages.send(MailpitSendRequest request) Sends a message through Mailpit's HTTP send API.setChaos(MailpitChaosTriggers triggers) Sets current chaos trigger settings.setMessageTags(MailpitSetTagsRequest request) Sets tags for messages.setReadStatus(MailpitSetReadStatusRequest request) Sets read status for messages without a timezone query parameter.setReadStatus(MailpitSetReadStatusRequest request, @Nullable String timezone) Sets read status for messages.Runs SpamAssassin check for a message.
-
Method Details
-
getInfo
Gets application information and mailbox totals.- Returns:
- Application information.
- See Also:
-
getWebUiConfiguration
Gets web UI configuration.- Returns:
- Web UI configuration.
- See Also:
-
getChaos
Gets current chaos trigger settings.- Returns:
- Chaos trigger settings.
- See Also:
-
setChaos
Sets current chaos trigger settings.- Parameters:
triggers- Chaos trigger settings.- Returns:
- Updated chaos trigger settings.
- See Also:
-
listMessages
@Get("/api/v1/messages") MailpitMessagesSummary listMessages(@QueryValue("start") @Nullable Integer start, @QueryValue("limit") @Nullable Integer limit) Lists mailbox messages from newest to oldest.- Parameters:
start- Pagination offset.limit- Maximum number of messages.- Returns:
- Message summaries.
- See Also:
-
setReadStatus
@Consumes("text/plain") @Put("/api/v1/messages") String setReadStatus(@Body MailpitSetReadStatusRequest request) Sets read status for messages without a timezone query parameter.- Parameters:
request- Read status request.- Returns:
- Plain text response.
- See Also:
-
setReadStatus
@Consumes("text/plain") @Put("/api/v1/messages") String setReadStatus(@Body MailpitSetReadStatusRequest request, @QueryValue("tz") @Nullable String timezone) Sets read status for messages.- Parameters:
request- Read status request.timezone- Optional timezone identifier for search date filters.- Returns:
- Plain text response.
- See Also:
-
deleteMessages
@Consumes("text/plain") @Delete("/api/v1/messages") String deleteMessages(@Body MailpitDeleteMessagesRequest request) Deletes messages.- Parameters:
request- Delete messages request.- Returns:
- Plain text response.
- See Also:
-
search
@Get("/api/v1/search") MailpitMessagesSummary search(@QueryValue("query") String query, @QueryValue("start") @Nullable Integer start, @QueryValue("limit") @Nullable Integer limit, @QueryValue("tz") @Nullable String timezone) Searches messages.- Parameters:
query- Search query.start- Pagination offset.limit- Maximum number of messages.timezone- Optional timezone identifier for date filters.- Returns:
- Message summaries.
- See Also:
-
deleteSearch
@Consumes("text/plain") @Delete("/api/v1/search") String deleteSearch(@QueryValue("query") String query, @QueryValue("tz") @Nullable String timezone) Deletes messages matching a search.- Parameters:
query- Search query.timezone- Optional timezone identifier for date filters.- Returns:
- Plain text response.
- See Also:
-
getMessage
Gets a message and marks it read.- Parameters:
id- Message database ID orlatest.- Returns:
- Message.
- See Also:
-
getMessageHeaders
-
getMessagePart
@Get("/api/v1/message/{id}/part/{partId}") io.micronaut.http.HttpResponse<byte[]> getMessagePart(@PathVariable("id") String id, @PathVariable("partId") String partId) Gets a message attachment or inline part.- Parameters:
id- Message database ID orlatest.partId- Attachment part ID.- Returns:
- Binary part response.
- See Also:
-
getMessagePartThumbnail
@Get("/api/v1/message/{id}/part/{partId}/thumb") io.micronaut.http.HttpResponse<byte[]> getMessagePartThumbnail(@PathVariable("id") String id, @PathVariable("partId") String partId) Gets an attachment image thumbnail.- Parameters:
id- Message database ID orlatest.partId- Attachment part ID.- Returns:
- Binary thumbnail response.
- See Also:
-
getRawMessage
-
releaseMessage
@Consumes("text/plain") @Post("/api/v1/message/{id}/release") String releaseMessage(@PathVariable("id") String id, @Body MailpitReleaseMessageRequest request) Releases a message through Mailpit's configured SMTP relay.- Parameters:
id- Message database ID orlatest.request- Release message request.- Returns:
- Plain text response.
- See Also:
-
htmlCheck
@Get("/api/v1/message/{id}/html-check") MailpitHtmlCheckResponse htmlCheck(@PathVariable("id") String id) Runs Mailpit's HTML compatibility check for a message.- Parameters:
id- Message database ID orlatest.- Returns:
- HTML check response.
- See Also:
-
linkCheck
@Get("/api/v1/message/{id}/link-check") MailpitLinkCheckResponse linkCheck(@PathVariable("id") String id, @QueryValue("follow") @Nullable Boolean follow) Runs Mailpit's link check for a message.- Parameters:
id- Message database ID orlatest.follow- Whether redirects should be followed.- Returns:
- Link check response.
- See Also:
-
spamAssassinCheck
@Get("/api/v1/message/{id}/sa-check") MailpitSpamAssassinResponse spamAssassinCheck(@PathVariable("id") String id) Runs SpamAssassin check for a message.- Parameters:
id- Message database ID orlatest.- Returns:
- SpamAssassin response.
- See Also:
-
send
@Consumes("text/plain") @Post("/api/v1/send") MailpitSendResponse send(@Body MailpitSendRequest request) Sends a message through Mailpit's HTTP send API.- Parameters:
request- Send request.- Returns:
- Send response.
- See Also:
-
getTags
-
setMessageTags
@Consumes("text/plain") @Put("/api/v1/tags") String setMessageTags(@Body MailpitSetTagsRequest request) Sets tags for messages.- Parameters:
request- Set tags request.- Returns:
- Plain text response.
- See Also:
-
renameTag
@Consumes("text/plain") @Put("/api/v1/tags/{tag}") String renameTag(@PathVariable("tag") String tag, @Body MailpitRenameTagRequest request) Renames a tag.- Parameters:
tag- Current tag name.request- Rename request.- Returns:
- Plain text response.
- See Also:
-
deleteTag
-
renderHtml
@Consumes("text/html") @Get("/view/{id}.html") String renderHtml(@PathVariable("id") String id, @QueryValue("embed") @Nullable String embed) Renders the message HTML part.- Parameters:
id- Message database ID orlatest.embed- Whether Mailpit should render iframe-friendly HTML.- Returns:
- Rendered HTML.
- See Also:
-
renderText
-