From b5d776bc5c8261ac75a74ed3070ca13a6eb741ca Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 25 Dec 2011 01:56:57 +0000 Subject: a mail notification is now sent when a user add a message to the help page of a wiki page --- h-source/Application/Include/params.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'h-source/Application/Include/params.php') diff --git a/h-source/Application/Include/params.php b/h-source/Application/Include/params.php index ba4fef3..007a3f8 100644 --- a/h-source/Application/Include/params.php +++ b/h-source/Application/Include/params.php @@ -170,5 +170,33 @@ class Account $result = $mailer->batchSend($message); } - + + static public function sendWikiTalkNotice($who,$e_mails,$id_wiki) + { + require_once (ROOT.'/External/swiftmailer/lib/swift_required.php'); + + $who = sanitizeAll($who); + $id_wiki = (int)$id_wiki; + + $siteName = Website::$generalName; + $siteMail = Website::$generalMail; + + $wiki = new WikiModel(); + $pageUrl = $wiki->toWikiPage($id_wiki); + $talkUrl = "http://".DOMAIN_NAME."/wiki/talk/".Lang::$current."/$id_wiki"; + + $mess = "$who has added a message to the talk page of a wiki page you have contributed to maintain at $siteName\n\nThe whole conversation is here:\n\n".$talkUrl."\n\nThe wiki page is here:\n\n".$pageUrl."\n\nBest regards\nthe ".Website::$projectName." team\n\nP.S: you can disable the mail notifications in the profile page of your control panel"; + + $message = Swift_Message::newInstance()->setSubject("$who sent a notice to your attention")->setFrom(array($siteMail => $siteName))->setTo($e_mails)->setBody($mess); + + //Create the Transport + $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword); + + //Create the Mailer using your created Transport + $mailer = Swift_Mailer::newInstance($transport); + + //Send the message + $result = $mailer->batchSend($message); + + } } \ No newline at end of file -- cgit v1.2.3