MessagePreview.php
[Pman.Core] / MessagePreview.php
index 161b830..2d76fb6 100644 (file)
@@ -36,6 +36,8 @@ class Pman_Core_MessagePreview extends Pman
     
     function post()
     {
+        print_r($_REQUEST);
+        exit;
         if(empty($_REQUEST['_id']) || empty($_REQUEST['_table'])){
             $this->jerr('Missing Options');
         }
@@ -83,9 +85,20 @@ class Pman_Core_MessagePreview extends Pman
         
         $x = new $cls;
         
-        if(!method_exists($x, "test_{$core_email->name}")){
-            $this->jerr("Function test_{$core_email->name} does not exists");
+        $method = "test_{$core_email->name}";
+        
+        if(!method_exists($x, $method)){
+            $this->jerr("{$method} does not exists in {$cls}");
+        }
+
+        $content = $x->{$method}($this, $this->authUser);
+        
+        $sent = $core_email->send($content);
+        
+        if(is_object($sent)){
+            $this->jerr("Error sending email - " . $sent->toString());
         }
         
+        $this->jok('SUCCESS');
     }
 }