greenmail
greenmail copied to clipboard
Support STARTTLS for SMTP,IMAP and POP3
None of the GreenMail services (IMAP,POP3,SMTP) support the STARTTLS command as specified in RFC 2487 (SMTP) and RFC 2595 (IMAP&POP3)
At the very least we should respond stating that the command isn't supported - when it is issued by the client.
It should be doable considering we already have support for SSL based connections. We would need to implement the appropriate handshake as stated in the RFC's and convert the existing Socket connection to an SSLSocket.
See this handy StackOverFlow post for more details.
@buildscientist Is this being actively worked on? I need this feature to test a mail client I'm writing.
If not, I can do it myself and submit a PR when I get some time(probably in the next couple of weeks).
I've added tentative support for STARTTLS for SMTP in my fork. You can check out the diffs HERE. This was implemented based on RFC3207.
If this looks ok, I can go ahead with implementing it for IMAP and POP3 in a similar fashion.
I am also planning to add Apache Commons Net as a Test Dependency and use it to write tests for checking STARTTLS commands.
Would be great to see this integrated... looking for the same feature.
@vinaysshenoy I'm not actively working on this enhancement. Recommend that you submit a PR (please make sure appropriate tests are included).
Thanks.
Status on this? Is this planned for the near future or not? Alot of cloud mail providers require STARTTLS, it would therefore be opportune to have this functionality available in GreenMail.
Are there any updates about this issue?
@shark300 Im curious, what exactly do you need this for? We currently support the "implicit TLS" variants, which is the recommended approach as of RFC8314. If you have further use-cases, do you think you would be able to provide a PR?
@apinske we have a use case for this, we have customers that have their mail servers configured in this way, and due to a bug in our code, the STARTTLS started to fail. We do not have control over our customers mail servers, indeed, sometimes our customers don't even have control over them, as that is outsourced.
Ideally this would have been caught by our unit tests, but we we can currently only test SMTP and SMTPS, but not SMTP/STARTTLS.
I would find STARTTLS support helpful because I use Mailtrap in production which only supports STARTTLS: https://help.mailtrap.io/article/40-mailtrap-sending-faqs