Файл: _rootsender.php
Строк: 35
<?
$full_home_path = dirname(__FILE__);
require_once($full_home_path."/_rootload.php");
mconnect();
EnableLanguages(1);
$queue = @mysql_query("select * from mail_queue where status='0' LIMIT 0,1") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while (@mysql_num_rows($queue) > 0) {
$queue = @mysql_fetch_object($queue);
@mysql_query("update mail_queue set status='1' where id='$queue->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if ($queue->to or $queue->email) {
$company_name = GetSetting("company_name");
$manager_email = GetSetting("manager_email");
$subject = $queue->subject;
$message = $queue->message;
$mailType = $queue->mailType; if ($mailType != "text" and $mailType != "html") { $mailType = "text"; }
if ($queue->to == "all") { $users = GetUsersAll(); }
else if ($queue->to == "server") { $users = GetUsersByServerId($queue->server); }
else if ($queue->to) { $users = GetUsersByOrderType($queue->to); }
if ($users) {
while ($user = mysql_fetch_object($users)) {
if ($user->news or $queue->ignore) {
WriteMailLog($subject,$message,$user->id);
sendmail($user->email, $company_name, $manager_email, htmlDecode($subject), htmlDecode($message), '', '', $mailType);
sendmail($user->email2, $company_name, $manager_email, htmlDecode($subject), htmlDecode($message), '', '', $mailType);
}
}
} else if ($queue->email) {
sendmail($queue->email, $company_name, $manager_email, htmlDecode($subject), htmlDecode($message), '', '', $mailType);
}
}
@mysql_query("delete from mail_queue where id='$queue->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$queue = @mysql_query("select * from mail_queue where status='0' LIMIT 0,1") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
mclose();
?>