<?php require_once('includes/PHPMailer/class.phpmailer.php'); require_once('includes/PHPMailer/class.pop3.php'); function sendmail($from,$to,$subject,$body) { global $Config; if ($Config->MailingMethod=='popsmtp') { $pop =new POP3(); $pop->Authorise( $Config->PopServer, $Config->PopPort, 30, $Config->PopUser, $Config->PopPass, 1); } $mail =new PHPMailer(true); if ($Config->MailingMethod=='sendmail') $mail->IsSendMail(); else $mail->IsSMTP(); try { $mail->CharSet='utf-8'; if (is_array($to)) { if (sizeof($to)>1) { while ($to) { $t=array_shift($to); if ($t) $mail->AddBCC($t); } } else $mail->AddAddress($to[0]); } else $mail->AddAddress($to); $mail->Host =$Config->SmtpServer; $mail->Port =$Config->SmtpPort; $mail->SetFrom($from); $mail->Subject =$subject; $mail->Body =$body; $mail->Send(); return true; } catch (phpmailerException $e) { echo $e->errorMessage(); return false; } catch (Exception $e) { echo $e->getMessage(); return false; } } function prepare_email_from_templates($subject_file,$body_file,$dataset) { global $Config; $loader=new TemplateLoader($dataset); $content_template=LanguageFiles($subject_file); $driver=$loader->load(array_pop($content_template),$Config->CachePrefix); ob_start(); $driver->output(); $subject=ob_get_contents(); ob_end_clean(); $loader=new TemplateLoader($dataset); $content_template=LanguageFiles($body_file); $driver=$loader->load(array_pop($content_template),$Config->CachePrefix); ob_start(); $driver->output(); $body=ob_get_contents(); ob_end_clean(); return array('subject'=>$subject,'body'=>$body); } ?>