]>
Commit | Line | Data |
---|---|---|
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 | |
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 | |
68fb3c95 | 20 | \r |
1b2afd2b | 21 | function __construct() {\r |
22 | $this->SetLanguage("en", "lib/phpmailer/language/");\r | |
b9863a15 | 23 | \r |
90df27a4 AD |
24 | if (SMTP_SERVER) {\r |
25 | $pair = explode(":", SMTP_SERVER, 2);\r | |
4f032700 | 26 | $this->Mailer = "smtp";\r |
b9863a15 | 27 | \r |
4f032700 AD |
28 | $this->Host = $pair[0];\r |
29 | $this->Port = $pair[1];\r | |
b9863a15 AD |
30 | \r |
31 | if (!$Port) $Port = 25;\r | |
32 | } else {\r | |
4f032700 AD |
33 | $this->Host = '';\r |
34 | $this->Port = '';\r | |
1b2afd2b | 35 | }\r |
b9863a15 | 36 | \r |
68fb3c95 | 37 | \r |
1b2afd2b | 38 | //if SMTP_LOGIN is specified, set credentials and enable auth\r |
39 | if(SMTP_LOGIN){\r | |
4f032700 AD |
40 | $this->SMTPAuth = true;\r |
41 | $this->Username = SMTP_LOGIN;\r | |
42 | $this->Password = SMTP_PASSWORD;\r | |
1b2afd2b | 43 | }\r |
44 | }\r | |
45 | /* @brief a simple mail function to send email using the defaults\r | |
46 | * This will send an HTML email using the configured defaults\r | |
47 | * @param $toAddress A string with the recipients email address\r | |
48 | * @param $toName A string with the recipients name\r | |
49 | * @param $subject A string with the emails subject\r | |
50 | * @param $body A string containing the body of the email\r | |
51 | */\r | |
52 | public function quickMail ($toAddress, $toName, $subject, $body, $altbody=""){\r | |
53 | $this->addAddress($toAddress, $toName);\r | |
54 | $this->Subject = $subject;\r | |
55 | $this->Body = $body;\r | |
68fb3c95 | 56 | $this->IsHTML($altbody != '');\r |
1b2afd2b | 57 | $rc=$this->send();\r |
58 | return $rc;\r | |
59 | }\r | |
60 | }\r | |
61 | \r | |
68fb3c95 | 62 | ?>\r |