update
This commit is contained in:
101
core/class/Mailer.class.php
Normal file
101
core/class/Mailer.class.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
require_once("../core/lib/phpmailer/class.phpmailer.php");
|
||||
|
||||
/**
|
||||
* Description of Mailer
|
||||
*
|
||||
* @author KoPi
|
||||
*/
|
||||
class Mailer extends PHPMailer{
|
||||
|
||||
public static $c_name = '__img_mail_container_3456__';
|
||||
public static $attachImages = true;
|
||||
|
||||
private $head;
|
||||
private $bottom;
|
||||
|
||||
function __construct() {
|
||||
$this->Config();
|
||||
$this->SetDefaultHtml();
|
||||
}
|
||||
|
||||
private function Config()
|
||||
{
|
||||
$this->Host='mediaflex.pl';
|
||||
$this->IsSMTP();
|
||||
$this->SetLanguage('pl', '../core/lib/phpmailer/language/');
|
||||
$this->Mailer='smtp';
|
||||
$this->Username = 'egw@mediaflex.pl';
|
||||
$this->Password = 'EgW_2009';
|
||||
$this->SMTPAuth = true;
|
||||
$this->From= 'egw@mediaflex.pl';
|
||||
$this->FromName = 'NASZA MEDYCYNA';
|
||||
$this->ContentType = 'text/html';
|
||||
$this->Ishtml(true);
|
||||
}
|
||||
|
||||
private function SetDefaultHtml()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function SendEmail($body,$altbody,$subject,$emails = null)
|
||||
{
|
||||
$this->Subject = $subject;
|
||||
if(is_array($emails))
|
||||
{
|
||||
foreach ($emails as $index => $value) {
|
||||
$this->AddAddress($value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!empty($emails)) {
|
||||
$this->AddAddress($emails);
|
||||
}
|
||||
}
|
||||
|
||||
$this->Body = $this->head . $body . $this->bottom;
|
||||
$this->AltBody = $altbody;
|
||||
|
||||
if(Mailer::$attachImages) {
|
||||
$imgContainer = Registry::Get(Mailer::$c_name);
|
||||
if(!empty($imgContainer)) {
|
||||
foreach($imgContainer as $img) {
|
||||
$this->AddEmbeddedImage(PATH_STATIC_CONTENT . 'image' . DIRECTORY_SEPARATOR . $img['img'], $img['name'], $img['img']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->Send())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ClearAttachments();
|
||||
$this->ClearAddresses();
|
||||
$this->ClearAttachments();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function GetHead() {
|
||||
return $this->head;
|
||||
}
|
||||
|
||||
public function SetHead($head) {
|
||||
$this->head = $head;
|
||||
}
|
||||
|
||||
public function GetBottom() {
|
||||
return $this->bottom;
|
||||
}
|
||||
|
||||
public function SetBottom($bottom) {
|
||||
$this->bottom = $bottom;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user