]> git.wh0rd.org - tt-rss.git/blame - classes/ttrssmailer.php
update .gitignore
[tt-rss.git] / classes / ttrssmailer.php
CommitLineData
1b2afd2b 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
9require_once 'lib/phpmailer/class.phpmailer.php';\r
eee818c4 10require_once 'lib/phpmailer/class.smtp.php';\r
1b2afd2b 11require_once "config.php";\r
12\r
13class ttrssMailer extends PHPMailer {\r
14\r
15 //define all items that we want to override with defaults in PHPMailer\r
16 public $From = SMTP_FROM_ADDRESS;\r
17 public $FromName = SMTP_FROM_NAME;\r
18 public $CharSet = "UTF-8";\r
19 public $PluginDir = "lib/phpmailer/";\r
20 public $ContentType = "text/html"; //default email type is HTML\r
68fb3c95 21\r
1b2afd2b 22 function __construct() {\r
23 $this->SetLanguage("en", "lib/phpmailer/language/");\r
b9863a15 24\r
90df27a4
AD
25 if (SMTP_SERVER) {\r
26 $pair = explode(":", SMTP_SERVER, 2);\r
4f032700 27 $this->Mailer = "smtp";\r
b9863a15 28\r
4f032700
AD
29 $this->Host = $pair[0];\r
30 $this->Port = $pair[1];\r
b9863a15 31\r
6f7798b6 32 if (!$this->Port) $this->Port = 25;\r
b9863a15 33 } else {\r
4f032700
AD
34 $this->Host = '';\r
35 $this->Port = '';\r
1b2afd2b 36 }\r
b9863a15 37\r
68fb3c95 38\r
1b2afd2b 39 //if SMTP_LOGIN is specified, set credentials and enable auth\r
40 if(SMTP_LOGIN){\r
4f032700
AD
41 $this->SMTPAuth = true;\r
42 $this->Username = SMTP_LOGIN;\r
43 $this->Password = SMTP_PASSWORD;\r
1b2afd2b 44 }\r
eee818c4
AD
45 if(SMTP_SECURE)\r
46 $this->SMTPSecure = SMTP_SECURE; \r
1b2afd2b 47 }\r
48 /* @brief a simple mail function to send email using the defaults\r
49 * This will send an HTML email using the configured defaults\r
50 * @param $toAddress A string with the recipients email address\r
51 * @param $toName A string with the recipients name\r
52 * @param $subject A string with the emails subject\r
53 * @param $body A string containing the body of the email\r
54 */\r
55 public function quickMail ($toAddress, $toName, $subject, $body, $altbody=""){\r
56 $this->addAddress($toAddress, $toName);\r
57 $this->Subject = $subject;\r
58 $this->Body = $body;\r
68fb3c95 59 $this->IsHTML($altbody != '');\r
1b2afd2b 60 $rc=$this->send();\r
61 return $rc;\r
62 }\r
ea79a0e0 63}