aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Include/params.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-01-26 03:05:35 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-01-26 03:05:35 +0000
commitf51c3d89d5118e45914a1de7f6bdb03dd559e32e (patch)
treec76ee67ddb62723503711175e406442b72c55103 /h-source/Application/Include/params.php
parent1ddc3583a205edd248a53fcf65e3fbad3664f85f (diff)
added mail notifications for talk messages
Diffstat (limited to 'h-source/Application/Include/params.php')
-rw-r--r--h-source/Application/Include/params.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/h-source/Application/Include/params.php b/h-source/Application/Include/params.php
index 7547643..1d3533b 100644
--- a/h-source/Application/Include/params.php
+++ b/h-source/Application/Include/params.php
@@ -141,5 +141,32 @@ class Account
}
}
+
+ static public function sendTalkNotice($who,$e_mails,$id_hard)
+ {
+ require_once (ROOT.'/External/swiftmailer/lib/swift_required.php');
+
+ $who = sanitizeAll($who);
+ $id_hard = (int)$id_hard;
+
+ $siteName = Website::$generalName;
+ $siteMail = Website::$generalMail;
+
+ $urls = getUrlsFromIdHard($id_hard);
+
+ $mess = "$who has added a message to the talk page of a device you have contributed to maintain at $siteName\n\nThe whole conversation is here:\n\n".$urls['urlTalk']."\n\nThe device page is here:\n\n".$urls['urlView']."\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