From 46d39c786458e0cdbef4f6f2d5b4ab26f41ea1b9 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Wed, 11 Nov 2015 01:49:15 +0100 Subject: [PATCH] Fix attachment --- src/main/java/fr/xephi/authme/SendMailSSL.java | 6 ++++-- src/main/resources/config.yml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 7fab5078..2a6083e7 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -53,11 +53,11 @@ public class SendMailSSL { email.addTo(mail); email.setFrom(acc, sender); email.setSubject(subject); - email.setHtmlMsg(mailText); email.setAuthentication(acc, password); email.setStartTLSEnabled(true); email.setStartTLSRequired(true); email.setSSLCheckServerIdentity(true); + String content = mailText; // Generate an image ? File file = null; if (Settings.generateImage) { @@ -66,11 +66,13 @@ public class SendMailSSL { file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); ImageIO.write(gen.generateImage(), "jpg", file); DataSource source = new FileDataSource(file); - email.embed(source, auth.getNickname() + "_new_pass.jpg"); + String tag = email.embed(source, auth.getNickname() + "_new_pass.jpg"); + content = content.replace("", ""); } catch (Exception e) { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } + email.setHtmlMsg(content); try { email.send(); } catch (Exception e) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 084b9cff..cbf62dcb 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -340,7 +340,7 @@ Email: # Email subject of password get mailSubject: 'Your new AuthMe Password' # Email text here - mailText: 'Dear ,

This is your new AuthMe password for the server

:



Do not forget to change password after login!
/changepassword newPassword' + mailText: 'Dear ,

This is your new AuthMe password for the server

:



Do not forget to change password after login!
/changepassword newPassword' # Like maxRegPerIp but with email maxRegPerEmail: 1 # Recall players to add an email ?