From 1b2afd2bd3dc19cdd36da47cc52040a83cdb3b68 Mon Sep 17 00:00:00 2001 From: derekmurawsky Date: Fri, 22 Mar 2013 16:25:12 -0400 Subject: Additions: classes/trssmailer.php - Created class TTRSS mailer which extends phpmailer and sets the default mail settings upon instantiation. Class includes quickmail function that allows for a quick email send with no extra configurion necessary. Changes: config.php-dist - Added the smtp port option include/digest.php - Converted it to use the new ttrrssmailer class include/sanity_config.php - Added the smtp port option to the sanity check plugins/mail/init.php - Modified to use ttrssmailer class. This particular configuration shows a hybrid use case. register.php = Modified to use ttrssmailer class. All code was tested and functioned on my local machine. --- plugins/mail/init.php | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'plugins') diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 30a417a1b..9d92781d7 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -137,7 +137,7 @@ class Mail extends Plugin { function sendEmail() { $secretkey = $_REQUEST['secretkey']; - require_once 'lib/phpmailer/class.phpmailer.php'; + require_once 'classes/ttrssmailer.php'; $reply = array(); @@ -146,35 +146,18 @@ class Mail extends Plugin { $_SESSION['email_secretkey'] = ''; - $destination = $_REQUEST['destination']; - $subject = $_REQUEST['subject']; - $content = $_REQUEST['content']; - $replyto = strip_tags($_SESSION['email_replyto']); $fromname = strip_tags($_SESSION['email_fromname']); - $mail = new PHPMailer(); - - $mail->PluginDir = "lib/phpmailer/"; - $mail->SetLanguage("en", "lib/phpmailer/language/"); - - $mail->CharSet = "UTF-8"; + $mail = new ttrssMailer(); $mail->From = $replyto; $mail->FromName = $fromname; - $mail->AddAddress($destination); - - if (SMTP_HOST) { - $mail->Host = SMTP_HOST; - $mail->Mailer = "smtp"; - $mail->SMTPAuth = SMTP_LOGIN != ''; - $mail->Username = SMTP_LOGIN; - $mail->Password = SMTP_PASSWORD; - } + $mail->AddAddress($_REQUEST['destination']); $mail->IsHTML(false); - $mail->Subject = $subject; - $mail->Body = $content; + $mail->Subject = $_REQUEST['subject']; + $mail->Body = $_REQUEST['content']; $rc = $mail->Send(); -- cgit v1.2.3