<?

//$_SERVER['DOCUMENT_ROOT'] = 'manual define';
require $_SERVER['DOCUMENT_ROOT'].'/inc/conf.php';
require _Core.'/extender.php';
require _Core.'/template.php';
require _Core.'/engine.php';

$self = new Engine;
$self->__init();
$self->callSqlClass(array('emails'), $self);
$self->callClass(array('Email'));


$self->emails->Select("WHERE is_sent = 0 ");
while($row = $self->emails->Assoc()){
	
	$self->Email->SendEmail($row['client_name'], $row['client_email'], $row['from_name'], $row['from_email'], $row['subject'], utf8_encode(html_entity_decode($row['content'])));
	$self->emails->Update(array('is_sent' => 1, 'sent_at' => 'NOW()'), "WHERE id = ".$row['id']);
	sleep(3);
}


?>