major revamp due to new Message constructors
[org.ibex.mail.git] / src / org / ibex / mail / Confirmation.java
index e64c658..2a1090b 100644 (file)
@@ -102,17 +102,20 @@ public abstract class Confirmation implements Externalizable {
     }
 
     public void signAndSend(Address sender, long secret, Date now) throws IOException, Message.Malformed {
-        SMTP.Outgoing.enqueue(Message.newMessage(new Fountain.StringFountain("From: "    + sender + "\r\n" +
-                                                                             "To: "      + who.toString(true) + "\r\n" +
-                                                                             "Subject: confirm " + getDescription() + "\r\n" +
-                                                                             "Message-Id: "+Message.generateFreshMessageId()+"\r\n" +
-                                                                             "\r\n" +
-                                                                             "Please click the link below to " + getDescription() + "\r\n" +
-                                                                             getURL(sign(secret))),
-                                                 sender,
-                                                 who
-                                                 )
-                              );
+
+        Headers h = new Headers(new String[] {
+            "From",        sender.toString(true),
+            "To",          who.toString(true),
+            "Message-Id",  Message.generateFreshMessageId(),
+            "Date",        new Date()+"" /*FIXME!!!*/,
+            "Subject",     "confirm " + getDescription()
+        });
+
+        Fountain fountain = Fountain.Util.create("Please click the link below to " +
+                                                 getDescription() + "\r\n" +
+                                                 getURL(sign(secret)));
+        Message m = Message.newMessageFromHeadersAndBody(h, fountain, sender, who);
+        SMTP.Outgoing.enqueue(m);
     }
 
     public String sign(long secret) throws IOException {