Skip to content
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

Email bug in StartTLS and advanced settings #519

Open
markkrj opened this issue Dec 11, 2019 · 0 comments · May be fixed by #494
Open

Email bug in StartTLS and advanced settings #519

markkrj opened this issue Dec 11, 2019 · 0 comments · May be fixed by #494

Comments

@markkrj
Copy link

markkrj commented Dec 11, 2019

SMTP has a bug introduced by 579c6ab

After trying out PWM 2.0 (master branch) with 1.9 config, SMTP started failing. Then I went on and investigated.

In 2.0 there was introduced two more options for SMTP configuration which are SMTPS (SMTP over SSL/TLS) and StartTLS (Plain SMTP with STARTTLS). But after trying everyone of them, I found out that the new StartTLS option does not work and plain SMTP does not use advanced settings anymore. We used StartTLS for over 3 years through advanced settings (mail.smtp.starttls.enable=true).

I went further and checked the code.
The following lines set SSL even if using StartTLS, which is wrong:

final MailSSLSocketFactory mailSSLSocketFactory = new MailSSLSocketFactory();
mailSSLSocketFactory.setTrustManagers( trustManager );
properties.put( "mail.smtp.ssl.enable", true );
properties.put( "mail.smtp.ssl.checkserveridentity", true );
properties.put( "mail.smtp.socketFactory.fallback", false );
properties.put( "mail.smtp.ssl.socketFactory", mailSSLSocketFactory );
properties.put( "mail.smtp.ssl.socketFactory.port", port );
final boolean useStartTls = smtpServerType == SmtpServerType.START_TLS;
properties.put( "mail.smtp.starttls.enable", useStartTls );
properties.put( "mail.smtp.starttls.required", useStartTls );

Also, the following is returning properties before putting advanced settings if using plain SMTP:

if ( smtpServerType == SmtpServerType.SMTP )
{
return properties;
}

So basically, the only working options are plain SMTP without advanced settings and SMTPS.

I proposed the PR #494 for this in July and it's still hanging without a comment. It fix the problem and does not conflict, so why not merge and fix this once and for all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant