]> 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 987c036ef5203b85ddd9e471730bcd131052dbe9..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 SomeCA.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("SomeCA.org Support!"));
-        EmailProvider.getInstance().sendMail(address, "[SomeCA.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);
     }
 
 }