#1075 Mail sender - allow to turn off TLS for port 25
This commit is contained in:
@@ -94,21 +94,6 @@ public class EmailService {
|
||||
return sendMailSSL.sendEmail(message, htmlEmail);
|
||||
}
|
||||
|
||||
public boolean sendTestEmail(String email) {
|
||||
HtmlEmail htmlEmail;
|
||||
try {
|
||||
htmlEmail = sendMailSSL.initializeMail(email);
|
||||
} catch (EmailException e) {
|
||||
ConsoleLogger.logException("Failed to create email for sample email:", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
htmlEmail.setSubject("AuthMe test email");
|
||||
String message = "Hello there!<br />This is a sample email sent to you from a Minecraft server ("
|
||||
+ serverName + ") via /authme debug mail. If you're seeing this, sending emails should be fine.";
|
||||
return sendMailSSL.sendEmail(message, htmlEmail);
|
||||
}
|
||||
|
||||
private File generateImage(String name, String newPass) throws IOException {
|
||||
ImageGenerator gen = new ImageGenerator(newPass);
|
||||
File file = new File(dataFolder, name + "_new_pass.jpg");
|
||||
|
||||
@@ -24,12 +24,8 @@ import static fr.xephi.authme.settings.properties.EmailSettings.MAIL_PASSWORD;
|
||||
*/
|
||||
public class SendMailSSL {
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
@Inject
|
||||
SendMailSSL(Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
private Settings settings;
|
||||
|
||||
/**
|
||||
* Returns whether all necessary settings are set for sending mails.
|
||||
@@ -115,8 +111,10 @@ public class SendMailSSL {
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
email.setStartTLSEnabled(true);
|
||||
email.setSSLCheckServerIdentity(true);
|
||||
if (settings.getProperty(EmailSettings.PORT25_USE_TLS)) {
|
||||
email.setStartTLSEnabled(true);
|
||||
email.setSSLCheckServerIdentity(true);
|
||||
}
|
||||
break;
|
||||
case 465:
|
||||
email.setSslSmtpPort(Integer.toString(port));
|
||||
|
||||
Reference in New Issue
Block a user