Fix issue with smtp and STARTTLS/SMTPS#494
Open
markkrj wants to merge 7 commits intopwm-project:masterfrom
Open
Fix issue with smtp and STARTTLS/SMTPS#494markkrj wants to merge 7 commits intopwm-project:masterfrom
markkrj wants to merge 7 commits intopwm-project:masterfrom
Conversation
SMTPS and STARTTLS doesn't work together. So this will test for the selected config (SMTPS or STARTTLS) and put the correct mail.smtp properties.
Author
|
@jrivard any comments on this? Not the proper solution? I tested every scenario and it actually fixed the bug. The current implementation is wrong as:
|
Remove wrongly inserted catch block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #519
We used starttls by setting mail.smtp.starttls.enable=true in advanced settings. After 579c6ab it started failing.
I wen't on and checked the new code. I'm not a programmer, but I think that with this piece of code, the advanced settings that are behind this try block will never run when using plain text SMTP.
I noticed also that if it was set to use START_TLS, it would also set SSL properties, which is wrong also.
It must be SSL (usually on port 465) or StartTLS (usually port 587). Never both.
As I'm not a programmer, I'm not sure that the small changes that I did are the correct approach for this issue but I tested and it worked for every scenarios that I thought would be more common as:
Plain SMTP with advanced mail.smtp.starttls.enable=true (As I was using before)
Plain SMTP with no starttls (usual no encryption, port 25, with auth).
SMTPS (with auth)
START_TLS (with auth)
Only scenarios that I didn't test are without authentication. But my patch didn't touch that.