ttrssMailer: actually use OOP properly

This commit is contained in:
Andrew Dolgov 2013-04-16 16:50:22 +04:00
parent 90df27a4c1
commit 4f032700db
2 changed files with 9 additions and 13 deletions

View File

@ -17,34 +17,29 @@ class ttrssMailer extends PHPMailer {
public $CharSet = "UTF-8"; public $CharSet = "UTF-8";
public $PluginDir = "lib/phpmailer/"; public $PluginDir = "lib/phpmailer/";
public $ContentType = "text/html"; //default email type is HTML public $ContentType = "text/html"; //default email type is HTML
public $Host;
public $Port;
public $SMTPAuth=False;
public $Username;
public $Password;
function __construct() { function __construct() {
$this->SetLanguage("en", "lib/phpmailer/language/"); $this->SetLanguage("en", "lib/phpmailer/language/");
if (SMTP_SERVER) { if (SMTP_SERVER) {
$pair = explode(":", SMTP_SERVER, 2); $pair = explode(":", SMTP_SERVER, 2);
$Mailer = "smtp"; $this->Mailer = "smtp";
$Host = $pair[0]; $this->Host = $pair[0];
$Port = $pair[1]; $this->Port = $pair[1];
if (!$Port) $Port = 25; if (!$Port) $Port = 25;
} else { } else {
$Host = ''; $this->Host = '';
$Port = ''; $this->Port = '';
} }
//if SMTP_LOGIN is specified, set credentials and enable auth //if SMTP_LOGIN is specified, set credentials and enable auth
if(SMTP_LOGIN){ if(SMTP_LOGIN){
$SMTPAuth = true; $this->SMTPAuth = true;
$Username = SMTP_LOGIN; $this->Username = SMTP_LOGIN;
$Password = SMTP_PASSWORD; $this->Password = SMTP_PASSWORD;
} }
} }
/* @brief a simple mail function to send email using the defaults /* @brief a simple mail function to send email using the defaults

View File

@ -26,6 +26,7 @@ function emailArticle(id) {
new Ajax.Request("backend.php", { new Ajax.Request("backend.php", {
parameters: dojo.objectToQuery(this.attr('value')), parameters: dojo.objectToQuery(this.attr('value')),
onComplete: function(transport) { onComplete: function(transport) {
console.log(transport.responseText);
var reply = JSON.parse(transport.responseText); var reply = JSON.parse(transport.responseText);