-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using directly TLS #265
Comments
Hi @tsmanuelanton. Currently no, it's only STARTTLS. Is there a particular reason you want/need TLS only? I'm not 100% sure if this is even possible via the smtpd module I use, so I'd need to look into that first. |
Thank you for your fast reply, @axllent 💯. I am using this server for integration tests and wanted to ensure that my code is compatible with TLS from the beginning. However, I will assume that if it works with STARTTLS, the same would happen with TLS. |
I cannot see why it wouldn't work. TLS requires encryption from beginning to end, where STARTTLS does not initially require it for the handshake. The thing to note is that if you are using authentication, TLS is required and your client must upgrade to TLS (unless you specifically disabled that in the Mailpit with So the short answer is, TLS is definitely used for sending using authentication (unless disabled in Mailpit), even when using STARTTLS. |
There might be some configuration issue on the server or in my code. I am using the Go if srv.Security == SecurityStartTLS {
if client, err = smtp.Dial(srv.ServerName()); err != nil {
return fmt.Errorf("new client: %w", err)
}
if err = client.StartTLS(tlsconfig); err != nil {
return fmt.Errorf("start TLS: %w", err)
}
} else if srv.Security == SecuritySSLTLS {
conn, err := tls.Dial("tcp", srv.ServerName(), tlsconfig)
if err != nil {
return fmt.Errorf("set TLS Dial: %w", err)
}
if client, err = smtp.NewClient(conn, srv.Host); err != nil {
return fmt.Errorf("new client: %w", err)
}
} else {
return fmt.Errorf("security not implemented")
} |
Maybe it does in fact require TSL (I've never tested that). Leave this with me and I'll look into how/if it's possible to add an option to Mailpit to use TSL instead of STARTTSL. I'm not too sure when I'll get a chance to look into it, bit I hope in the next couple of days. |
Thank you very much, I really appreciate your help. Please, don't feel the need to rush for me 😄. |
You are absolutely correct - I have been doing a bit of testing and you cannot connect to STARTTLS directly using TLS in a client. The good news it I can add this feature (it is supported) - I just need to figure out a way to add it so that it makes sense to the user. Currently there are the following logic in Mailpit:
Now I want to add the option for actual TLS (only) which means that the entire connection must run only over TLS only. This aligns with the TLSListener flag, and is different to STARTTLS because the TCP handshake is encrypted too (and why the two are not compatible even though they both use TLS). As you can probably see, there will be probably confusion for Mailpit users because of the existing I think I may have to deprecate the
I am thinking maybe I'm going to slap on this decision as I may have a fresh idea in the morning, but I'd appreciate your comments if you have any. Sorry for the long post! |
Apologies for the extra workload 😉. Although I'm not very familiar with this topic, you might consider keeping the |
Unfortunately that's not how it works, TLS is TLS and doesn't support upgrading from an unencrypted connection (it doesn't allow an unencrypted connection at all). STARTTLS on the other hand does, which is why it is the more common (though slightly less secure) protocol as it is more backwards compatible. This is why email providers who support both protocols run these on different ports. Ultimately I predict everything will eventually move to pure TLS in the future (a bit like HTTPS), but that's not for a long time. In the meantime I will add the option soon to use TLS (instead of STARTTLS) for those like yourself wanting to explicitly test SSL/TLS rather than STARTTLS. I just need to implement it and do the changes I mentioned earlier. I'll also need to write up some documentation as this is a somewhat confusing topic to most. Also don't apologise for the time/work to implement this. This investigation has allowed me to investigate and better understand the SMTP protocols and their differences, and I see the benefits of adding this feature 👍 |
@tsmanuelanton I have just released a new version of Mailpit (v1.15.0) which includes TLS support for SMTP 🥳 You can read the documentation on the website. Please confirm this works for you? |
It's |
My bad, I am dumb 💀. Yeah, now it works fine. Much thank you! |
Excellent, thanks for the feedback! |
excellent jobs,but i want more,can we support pop3 tls(pop3s) as smtps? |
thanks, I think it was pop3 with starttls. I use this soft to test multiple email protocols ,so i need pop3,pop3 with starttls,pop3s etc. so it support pop3s and pop currently, but lack pop3 with starttls? |
Sorry, STARTTLS for the POP3 server is currently not supported. |
Hi, maybe I'm missing something, but is there a way to connect using TLS directly instead of starting without encryption and then upgrading with STARTTLS?
The text was updated successfully, but these errors were encountered: