]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/email/MailProbe.java
upd: more realistic content-type for cert-downloads from API
[gigi.git] / src / org / cacert / gigi / email / MailProbe.java
index 7bca705cbd288beb25305bc3e20d8dea78d67dd4..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.getWwwHostNamePort());
-        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);
     }
 
 }