mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 08:45:54 +03:00
[GH-ISSUE #255] API to Identify Missing and Incorrectly Formatted Headers #169
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#169
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 @skoomer01 on GitHub (Feb 28, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/255
I know Mailpit offers an API that provides email headers, which is incredibly useful. Would it be possible to also have an API that specifically highlights any missing headers and identifies those that are incorrectly formatted? I was thinking it offering a breakdown of missing headers and flagging any headers that do not adhere to standard formatting conventions.

Showing only information like this.
@axllent commented on GitHub (Feb 28, 2024):
Hi @skoomer01. I am a bit confused as both Date and Message-Id are added automatically via the SMTP process, so those would never be missing in Mailpit. Do you have examples of messages in Mailpit where these headers are missing?
Formatting is a different story though, and I'm really not sure how that could be addressed. Can you please explain in more detail how these messages are being generated, and what happens when you deliver them to Mailpit?
@skoomer01 commented on GitHub (Feb 29, 2024):
Hi, sorry for the confusion, I am a junior developer so I might not phrase my questions all that good :).
I am working on a bigger project that doesnt use mailpit yet but they want to implement a way of checking if an email has all the needed headers before sending it, so I asked if there is a plan on implementing an API for that in the future. Since I dont use Mailpit in this project yet I cant provide examples of messages.
The missing messages are not from Mailpit, I use another web GUI for checking spamminess, I just used that photo as an example of how I thought the response from the API would look like.
Sorry again for the confusion.
@axllent commented on GitHub (Feb 29, 2024):
No problem @skoomer01. I believe that what you are looking for may already be covered using the SpamAssassin integration which Mailpit already has, and which appears to be similar to (if not the same) tool you are comparing it to in that screenshot. Please note that the SpamAssassin integration is still somewhat experimental, although appears to work as expected in my testing. There is also an experimental API endpoint to test it via an API.
This is not really a "check to see if all headers are correct", as there really isn't a way of doing this accurately (there are just so many headers), but SpamAssassin will probably trigger with common errors. Also to answer your question (as best I can), there are no plans to try validate email headers directly in Mailpit. the SMTP protocol already has checks in place for the most important headers required to send, so my the time Mailpit stores the message it has passed those tests (else it would most likely get rejected by the SMTP server.
I hope this answers your question?
@skoomer01 commented on GitHub (Feb 29, 2024):
Thank you so much for the response. I was originally looking at the SpamAssassin check in the API documentation and wanted to see if I can implement that but since the note said its still experimental I hesitated. But if it worked as expected in your testing I might try and see if I can make use of it.
I thought it was easier to check if all headers are correct but I see your point now :)
Thanks again, you were very helpful.