Exemple #1
0
 /**
  * This function is used to send notification
  * @param string $message the body of the message
  * @param object $subscriber the subscriber who subscribe or unsubscribe
  * @param object $owner the owner of the list
  * @param object $list the list
  * @param string $subject the subject of the notification
  * @return
  */
 public static function sendNotification($body, $subscriber, $owner, $list, $subject)
 {
     if (empty($owner->email)) {
         return true;
     }
     $mailing = new stdClass();
     $status = false;
     //we replaced the tag in the body of the notification
     ###list = [ id,list_name ] ; subscriber = [ name, email ] ; $owner = [ name, email ]
     $content = jNews_ProcessMail::_replaceTagNotify($body, $subscriber, $owner, $list);
     $mailing->id = 1;
     $mailing->images = '';
     $mailing->attachments = '';
     $mailing->fromname = trim($GLOBALS[JNEWS . 'sendmail_name']);
     $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_email']);
     if (empty($mailing->fromemail)) {
         $mailing->fromemail = trim($GLOBALS[JNEWS . 'sendmail_from']);
     }
     ### create the mail
     $mail = jNews_ProcessMail::getMailer($mailing);
     ### create content
     $mail->IsHTML(true);
     $mail->Body = $content;
     $mail->AddAddress($owner->email, @$owner->name);
     $mail->Subject = $subject;
     // DKIM code addition by Amod begins
     $mail = self::_addDKIM($mail);
     // DKIM code addition by Amod ends
     $status = $mail->Send();
     return $status;
 }