OssnMail.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Open Source Social Network
4  *
5  * @package (Informatikon.com).ossn
6  * @author OSSN Core Team <[email protected]>
7  * @copyright 2014 iNFORMATIKON TECHNOLOGIES
8  * @license General Public Licence http://www.opensource-socialnetwork.org/licence
9  * @link http://www.opensource-socialnetwork.org/licence
10  */
11 
12 //get phpmailer autload
13 require_once(ossn_route()->classes . 'mail/PHPMailerAutoload.php');
14 
15 class OssnMail extends PHPMailer {
16  /**
17  * Send email to user.
18  *
19  * @param string $email User email address
20  * @param string $subject Email subject
21  * @param string $body Email body
22  *
23  * @return boolean
24  */
25  public function NotifiyUser($email, $subject, $body) {
26  if(empty($email)){
27  error_log('Can not send email to empty email address', 0);
28  }
29  $this->setFrom(ossn_site_settings('notification_email'), ossn_site_settings('site_name'));
30  $this->addAddress($email);
31 
32  $this->Subject = $subject;
33  $this->Body = $body;
34  $this->CharSet = "UTF-8";
35 
36  try {
37  $send = ossn_call_hook('email', 'send', $this->send(), $this);
38  if($send) {
39  return true;
40  }
41  }
42  catch(phpmailerException $e) {
43  error_log("Cannot send email " . $e->errorMessage(), 0);
44  }
45  return false;
46  }
47 
48 } //class