]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/email/MailProbe.java
upd: transform existing mails into mail templates
[gigi.git] / src / org / cacert / gigi / email / MailProbe.java
index 8a0eaae1b9cfb1481445cdf36ff952a4a3e777ba..4da2648ae83d36f6eed4138829c390e7be839620 100644 (file)
@@ -1,28 +1,20 @@
 package org.cacert.gigi.email;
 
 import java.io.IOException;
+import java.util.HashMap;
 
 import org.cacert.gigi.localisation.Language;
+import org.cacert.gigi.output.template.MailTemplate;
 import org.cacert.gigi.util.ServerConstants;
 
 public class MailProbe {
 
+    private static final MailTemplate mailProbe = new MailTemplate(MailProbe.class.getResource("MailProbe.templ"));
+
     public static void sendMailProbe(Language l, String type, int id, String hash, String address) throws IOException {
-        StringBuffer body = new StringBuffer();
-        body.append(l.getTranslation("Thanks for signing up with CAcert.org, below is the link you need to open to verify your account. Once your account is verified you will be able to start issuing certificates till your hearts' content!"));
-        body.append("\n\nhttps://");
-        body.append(ServerConstants.getWwwHostNamePortSecure());
-        body.append("/verify?type=");
-        body.append(type);
-        body.append("&id=");
-        body.append(id);
-        body.append("&hash=");
-        body.append(hash);
-        body.append("\n\n");
-        body.append(l.getTranslation("Best regards"));
-        body.append("\n");
-        body.append(l.getTranslation("CAcert.org Support!"));
-        EmailProvider.getInstance().sendmail(address, "[CAcert.org] " + l.getTranslation("Mail Probe"), body.toString(), "support@cacert.org", null, null, null, null, false);
+        HashMap<String, Object> vars = new HashMap<>();
+        vars.put("link", "https://" + ServerConstants.getWwwHostNamePortSecure() + "/verify?type=" + type + "&id=" + id + "&hash=" + hash);
+        mailProbe.sendMail(l, vars, address);
     }
 
 }