#1034 Create subcommand to send test email

- Add test email feature
- Change debug command to lazily instantiate its subcommands
This commit is contained in:
ljacqu
2017-02-18 17:53:34 +01:00
parent c9b66183de
commit 6937dd37fb
3 changed files with 112 additions and 12 deletions
@@ -109,6 +109,21 @@ public class SendMailSSL {
return sendEmail(message, htmlEmail);
}
public boolean sendTestEmail(String email) {
HtmlEmail htmlEmail;
try {
htmlEmail = 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 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");