Add UserCake
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / users / models / class.mail.php
1 <?php\r
2 /*\r
3 UserCake Version: 2.0.2\r
4 http://usercake.com\r
5 */\r
6 \r
7 class userCakeMail {\r
8         //UserCake uses a text based system with hooks to replace various strs in txt email templates\r
9         public $contents = NULL;\r
10         \r
11         //Function used for replacing hooks in our templates\r
12         public function newTemplateMsg($template,$additionalHooks)\r
13         {\r
14                 global $mail_templates_dir,$debug_mode;\r
15                 \r
16                 $this->contents = file_get_contents($mail_templates_dir.$template);\r
17                 \r
18                 //Check to see we can access the file / it has some contents\r
19                 if(!$this->contents || empty($this->contents))\r
20                 {\r
21                         return false;\r
22                 }\r
23                 else\r
24                 {\r
25                         //Replace default hooks\r
26                         $this->contents = replaceDefaultHook($this->contents);\r
27                         \r
28                         //Replace defined / custom hooks\r
29                         $this->contents = str_replace($additionalHooks["searchStrs"],$additionalHooks["subjectStrs"],$this->contents);\r
30                         \r
31                         return true;\r
32                 }\r
33         }\r
34         \r
35         public function sendMail($email,$subject,$msg = NULL)\r
36         {\r
37                 global $websiteName,$emailAddress;\r
38                 \r
39                 $header = "MIME-Version: 1.0\r\n";\r
40                 $header .= "Content-type: text/plain; charset=iso-8859-1\r\n";\r
41                 $header .= "From: ". $websiteName . " <" . $emailAddress . ">\r\n";\r
42                 \r
43                 //Check to see if we sending a template email.\r
44                 if($msg == NULL)\r
45                         $msg = $this->contents; \r
46                 \r
47                 $message = $msg;\r
48                 \r
49                 $message = wordwrap($message, 70);\r
50                 \r
51                 return mail($email,$subject,$message,$header);\r
52         }\r
53 }\r
54 \r
55 ?>

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