mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 08:45:54 +03:00
[GH-ISSUE #264] Testing for missing Message-ID fails #173
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#173
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 @Schrank on GitHub (Mar 11, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/264
Hi! Thanks for offering a tool after mailhog is archived.
I'm from the MageOne project, we are offering patches for Magento 1 which is EOL. A little context, because my question might sound weird.
Magento 1/Zend_Framework doesn't add a Message-Id, when they send an email via sendmail. We fixed that and wrote a test to make sure this works. This test is supposed to run against an unpatched version, so we are sure, the patch does what it should.
Since the update from ddev (which changed mailhog to mailpit) this test is always green, because (and here is my assumption after reading the docs), mailpit always adds a Message-Id. I read, that this is true for SMTP. Technically we don't use SMTP, we use sendmail, but maybe sendmail is using SMTP internally?
My question is: Is mailpit adding a Message-Id for emails send via sendmail and if yes, is there a way not to?
I absolutely think it doesn't make sense to break this behaviour by changing it, so this is no feature request! I would like to fix our test, but if this doesn't work, I guess it is time to remove mailpit for THIS particular test and write a new one :-)
Thanks again for your time building it and reading this!
@axllent commented on GitHub (Mar 11, 2024):
@Schrank - that is a very good question, and the answer is is a little bit subjective - I'll try explain in the most logical manner.
Firstly it is worth noting that there are a lot of different SMTP servers, sendmail "clones", and thousands of email generation libraries & frameworks - any they all work slightly differently which can make it a bit frustrating at times. They should however all adhere to the email/SMTP standards (and many don't unfortunately, so more popular mail servers also tend to try "correct" common mistakes).
Basically, whilst a mail client/library/framework can provide a
Message-Id, it does not need to provide aMessage-Idat all. Some mail classes/programs add this field automatically before sending, others do not - again, it is completely optional.Message-Idsare added automatically by SMTP servers if a message does not already have one, and even in some cases an existing one could even be overwritten by an SMTP server (unusual, but possible). AMessage-Idis an required field for SMTP servers to talk to each other, and if mostly used to (internally) identify a message when grouping messages together (eg: a threaded view). Mailpit works in this way too - if it received a message without aMessage-Idthen it will automatically generate a unique one and append it to the email head. It is even possible/legal (though not advisable) to have multiple emails with the sameMessage-Id.To confuse matters, some "sendmail" implementations add a
Message-Idif it is missing, but again, this is not required at that level. Your app communicated with sendmail as a command-line "function", but sendmail then communicate with the SMTP server using SMTP. As I mentioned earlier, if the message still does not have aMessage-Idwhen it reaches the SMTP server, then the SMTP server assigns one.So to get back to your questions, the Magento 1/Zend_Framework does not actually have to provide a
Message-Id. There is nothing wrong in doing so, but it's not required as this is added by the SMTP server if it is missing. Any mail captured in Mailpit (as with any any SMTP server) will also always have aMessage-Idin the same manner. Does this help?@Schrank commented on GitHub (Mar 11, 2024):
Wow, thanks for writing this up! That helps a lot! I’ll delete the test and write a unit test 😂 far less systems involved.
again: thanks, learned a lot!
@axllent commented on GitHub (Mar 12, 2024):
Not a problem, and glad I could help!