Open sbeitzel opened 2 years ago
Thanks for the submission @sbeitzel and for your review @mbarnach. Cursory glance looks okay to me, I'll aim to look more closely this weekend if that's okay for you. Please don't worry if I close/open the PR, which I'll probably have to do to ensure travis is integrated correctly. It might take a little extra time since I just realized something happened to the server I was using as a docker registry and will have to rebuild it.
@sbeitzel I had to make some changes to CI, would you mind rebasing?
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
In some cases a server can support authenticated and unauthenticated connections. Does this change support unauthenticated connections to servers which support both?
Not a contribution
Without a test to prove it, I can only say, "Sure, should do." Note that the calling code still needs to set up the SMTP
instance, and it's the initializer of SMTP
that sets up authentication. So, the calling code needs to be aware of whether it's trying to authenticate or not.
Fix issue #107 by only trying to authenticate if the server advertises the AUTH extended capability.
Description
During socket initialization, we will check to see if the server even supports AUTH before we attempt to perform a login.
Motivation and Context
Not every SMTP server requires authentication. If you try to use this library to connect to one such, you will have no luck. A trivial real-world use case for this would be a docker container that's running an open SMTP relay but which is only accessible to an application server running in a different container. It seems strange for an SMTP client library to enforce a server's authentication policy, and to limit itself to connecting only to servers which support an optional command.
Fixes issue #107
How Has This Been Tested?
Running an open, "dummy" SMTP server locally, I tried to connect an SMTPSocket to it. Initially, since the server did not advertise an AUTH capability, this threw an exception. After the change, the connection succeeded.
Checklist: