]>
git.wh0rd.org - tt-rss.git/blob - classes/ttrssmailer.php
3 * @brief A TTRSS extension to the PHPMailer class
4 * Configures default values through the __construct() function
5 * @author Derek Murawsky
9 require_once 'lib/phpmailer/class.phpmailer.php';
10 require_once 'lib/phpmailer/class.smtp.php';
11 require_once "config.php";
13 class ttrssMailer
extends PHPMailer
{
15 //define all items that we want to override with defaults in PHPMailer
16 public $From = SMTP_FROM_ADDRESS
;
17 public $FromName = SMTP_FROM_NAME
;
18 public $CharSet = "UTF-8";
19 public $PluginDir = "lib/phpmailer/";
20 public $ContentType = "text/html"; //default email type is HTML
22 function __construct() {
23 $this->SetLanguage("en", "lib/phpmailer/language/");
26 $pair = explode(":", SMTP_SERVER
, 2);
27 $this->Mailer
= "smtp";
29 $this->Host
= $pair[0];
30 $this->Port
= $pair[1];
32 if (!$this->Port
) $this->Port
= 25;
39 //if SMTP_LOGIN is specified, set credentials and enable auth
41 $this->SMTPAuth
= true;
42 $this->Username
= SMTP_LOGIN
;
43 $this->Password
= SMTP_PASSWORD
;
46 $this->SMTPSecure
= SMTP_SECURE
;
48 /* @brief a simple mail function to send email using the defaults
49 * This will send an HTML email using the configured defaults
50 * @param $toAddress A string with the recipients email address
51 * @param $toName A string with the recipients name
52 * @param $subject A string with the emails subject
53 * @param $body A string containing the body of the email
55 public function quickMail ($toAddress, $toName, $subject, $body, $altbody=""){
56 $this->addAddress($toAddress, $toName);
57 $this->Subject
= $subject;
59 $this->IsHTML($altbody != '');