]> git.wh0rd.org Git - tt-rss.git/blob - classes/ttrssmailer.php
update description of DEFAULT_UPDATE_INTERVAL
[tt-rss.git] / classes / ttrssmailer.php
1 <?php\r
2 /*      @class ttrssMailer\r
3 *       @brief A TTRSS extension to the PHPMailer class\r
4 *       Configures default values through the __construct() function\r
5 *       @author Derek Murawsky\r
6 *       @version .1 (alpha)\r
7 *\r
8 */\r
9 require_once 'lib/phpmailer/class.phpmailer.php';\r
10 require_once "config.php";\r
11 \r
12 class ttrssMailer extends PHPMailer {\r
13 \r
14                 //define all items that we want to override with defaults in PHPMailer\r
15                 public $From = SMTP_FROM_ADDRESS;\r
16                 public $FromName = SMTP_FROM_NAME;\r
17                 public $CharSet = "UTF-8";\r
18                 public $PluginDir = "lib/phpmailer/";\r
19                 public $ContentType = "text/html"; //default email type is HTML\r
20                 public $Host;\r
21                 public $Port;\r
22                 public $SMTPAuth=False;\r
23                 public $Username;\r
24                 public $Password;\r
25 \r
26         function __construct() {\r
27                 $this->SetLanguage("en", "lib/phpmailer/language/");\r
28                 //if SMTP_HOST is specified, use SMTP to send mail directly\r
29                 if (SMTP_HOST) {\r
30                         $Host = SMTP_HOST;\r
31                         $Mailer = "smtp";\r
32                 }\r
33                 //if SMTP_PORT is specified, assign it. Otherwise default to port 25\r
34                 if(SMTP_PORT){\r
35                         $Port = SMTP_PORT;\r
36                 }else{\r
37                         $Port = "25";\r
38                 }\r
39 \r
40                 //if SMTP_LOGIN is specified, set credentials and enable auth\r
41                 if(SMTP_LOGIN){\r
42                         $SMTPAuth = true;\r
43                         $Username = SMTP_LOGIN;\r
44                         $Password = SMTP_PASSWORD;\r
45                         }\r
46         }\r
47         /*      @brief a simple mail function to send email using the defaults\r
48         *       This will send an HTML email using the configured defaults\r
49         *       @param $toAddress A string with the recipients email address\r
50         *       @param $toName A string with the recipients name\r
51         *       @param $subject A string with the emails subject\r
52         *       @param $body A string containing the body of the email\r
53         */\r
54         public function quickMail ($toAddress, $toName, $subject, $body, $altbody=""){\r
55                 $this->addAddress($toAddress, $toName);\r
56                 $this->Subject = $subject;\r
57                 $this->Body = $body;\r
58                 $this->IsHTML($altbody != '');\r
59                 $rc=$this->send();\r
60                 return $rc;\r
61         }\r
62 }\r
63 \r
64 ?>\r