diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-12-25 01:56:57 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-12-25 01:56:57 +0000 |
commit | b5d776bc5c8261ac75a74ed3070ca13a6eb741ca (patch) | |
tree | 3c769ed0f74963cf1e1b2ade33846deb9cb9e043 /h-source/Application/Include/params.php | |
parent | fe4d464805d9c6d3471dbfab6e20cc960fdfd329 (diff) |
a mail notification is now sent when a user add a message to the help page of a wiki page
Diffstat (limited to 'h-source/Application/Include/params.php')
-rw-r--r-- | h-source/Application/Include/params.php | 30 |
1 files changed, 29 insertions, 1 deletions
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 |