Пример #1
0
 public function send($from, $recipients, $subject, $template, $params = array(), $separate = false)
 {
     //--proccessing the message
     $smarty = new NgsSmarty($this->config["static"]);
     $smarty->assign("ns", $params);
     $message = $smarty->fetch($template);
     $this->SetFrom($from, "");
     $this->AddReplyTo($from, "");
     $this->Subject = $subject;
     //$this->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
     $this->MsgHTML($message);
     // multiple recipients
     if ($separate) {
         $to = "";
         foreach ($recipients as $recipient) {
             $this->AddAddress($recipient, '');
             $this->Send();
         }
     } else {
         $to = "";
         foreach ($recipients as $recipient) {
             $this->AddAddress($recipient, '');
         }
         return parent::Send();
     }
     //$mail->AddAttachment("images/phpmailer.gif");      // attachment
     //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
 }
Пример #2
0
 public function send($from, $recipients, $subject, $template, $params = array(), $separate = false)
 {
     //--proccessing the message
     $smarty = new NgsSmarty($this->config["static"]);
     $smarty->assign("ns", $params);
     $message = $smarty->fetch($template);
     // To send HTML mail, the Content-type header must be set
     $headers = "";
     //'MIME-Version: 1.0' . "\r\n";
     $headers .= 'MIME-Version: 1.0' . "\n";
     //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
     $headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\n";
     // Additional headers
     //			$headers .= 'To: Mary <*****@*****.**>, Kelly <*****@*****.**>' . "\r\n";
     $headers .= "From: {$from}" . "\n";
     //		$headers .= 'To: Mary <*****@*****.**>, Kelly <*****@*****.**>' . "\r\n";
     //		$headers .= 'From: Birthday Reminder <*****@*****.**>' . "\r\n";
     //		$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
     //		$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
     // multiple recipients
     if ($separate) {
         $to = "";
         foreach ($recipients as $recipient) {
             $to .= "{$recipient}";
             mail($to, $subject, $message, $headers);
         }
     } else {
         $to = "";
         foreach ($recipients as $recipient) {
             $to .= "{$recipient}" . ',';
         }
         return mail($to, $subject, $message, $headers);
     }
 }