Add UserCake
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / users / models / class.mail.php
diff --git a/testing/MCTXWeb/public_html/users/models/class.mail.php b/testing/MCTXWeb/public_html/users/models/class.mail.php
new file mode 100644 (file)
index 0000000..55fdac8
--- /dev/null
@@ -0,0 +1,55 @@
+<?php\r
+/*\r
+UserCake Version: 2.0.2\r
+http://usercake.com\r
+*/\r
+\r
+class userCakeMail {\r
+       //UserCake uses a text based system with hooks to replace various strs in txt email templates\r
+       public $contents = NULL;\r
+       \r
+       //Function used for replacing hooks in our templates\r
+       public function newTemplateMsg($template,$additionalHooks)\r
+       {\r
+               global $mail_templates_dir,$debug_mode;\r
+               \r
+               $this->contents = file_get_contents($mail_templates_dir.$template);\r
+               \r
+               //Check to see we can access the file / it has some contents\r
+               if(!$this->contents || empty($this->contents))\r
+               {\r
+                       return false;\r
+               }\r
+               else\r
+               {\r
+                       //Replace default hooks\r
+                       $this->contents = replaceDefaultHook($this->contents);\r
+                       \r
+                       //Replace defined / custom hooks\r
+                       $this->contents = str_replace($additionalHooks["searchStrs"],$additionalHooks["subjectStrs"],$this->contents);\r
+                       \r
+                       return true;\r
+               }\r
+       }\r
+       \r
+       public function sendMail($email,$subject,$msg = NULL)\r
+       {\r
+               global $websiteName,$emailAddress;\r
+               \r
+               $header = "MIME-Version: 1.0\r\n";\r
+               $header .= "Content-type: text/plain; charset=iso-8859-1\r\n";\r
+               $header .= "From: ". $websiteName . " <" . $emailAddress . ">\r\n";\r
+               \r
+               //Check to see if we sending a template email.\r
+               if($msg == NULL)\r
+                       $msg = $this->contents; \r
+               \r
+               $message = $msg;\r
+               \r
+               $message = wordwrap($message, 70);\r
+               \r
+               return mail($email,$subject,$message,$header);\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file

UCC git Repository :: git.ucc.asn.au