Viewing file: send_mod.php (2.94 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
include("../include/lib/class.phpmailer.php");
include("../include/config.php");
include("../include/lib/libconfig.php");
include("../include/lib/libnewsletter.php");
include("../include/grab_globals.inc.php");
include("include/function.php");
include("../include/db/db_".$db_type.".inc.php");
$conf = new config();
$conf->getConfig($hostname,$login ,$pass,$database, $table_global_config);
if(!checkAdminAccess($conf->admin_pass, $form_pass))
header("Location:index.php");
switch($step)
{
case "send":
$limit = $conf->sending_limit;
$mail = new phpmailer();
$mail->PluginDir= "../include/lib/";
switch($conf->sending_method){
case "smtp":
$mail->IsSMTP();
$mail->Host = $conf->smtp_host;
if($conf->smtp_auth){
$mail->SMTPAuth = true;
$mail->Username = $conf->smtp_login;
$mail->Password = $conf->smtp_pass;
}
break;
case "php_mail":
$mail->IsMail();
break;
default:
break;
}
$newsletter = new Newsletter();
$newsletter->getConfig($hostname,$login ,$pass,$database, $list_id,$conf->table_listsconfig);
$mail->From = $from;
$mail->FromName = $from;
//get address
$addr = $newsletter->getAddress($conf->table_email,$begin,$limit);
for($i=0; $i<sizeof($addr) ; $i++){
$mail->AddBCC($addr[$i]);
//echo "--".$addr[$i]."<br>";
}
$msg = get_message($hostname,$login ,$pass,$database, $conf->table_archives,$msg_id);
$format = $msg[0];
$subject = stripslashes($msg[1]);
$message = stripslashes($msg[2]);
$message.= "\n\nPour vous desinscrire :\n";
$message.= $conf->base_url.$conf->path;
// $mail->WordWrap = 50;
if($format=="html") $mail->IsHTML(true); // send as HTML
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->Send())
{
$error++;
echo $mail->ErrorInfo."<br>";
echo $begin;
break;
}
$begin+=$limit;
if($begin<$sn){
header("location:send_mod.php?step=send&error=$error&begin=$begin&list_id=$list_id&msg_id=$msg_id&sn=$sn&from=$from&m_id=$m_id");
}
else
header("location:index.php?page=moderation&op=mod&error=$error&list_id=$list_id&m_id=$m_id");
break;
default:
$conf = new config();
$conf->getConfig($hostname,$login ,$pass,$database, $table_global_config);
$message =urldecode($message);
// save the message in the database
$amsg_id = save_message($hostname,$login ,$pass,$database, $conf->table_archives, addslashes($subject), $format, addslashes($message), $date, $list_id);
//echo $list_id;
$newsletter = new Newsletter();
$newsletter->getConfig($hostname,$login ,$pass,$database, $list_id,$conf->table_listsconfig);
$num = $newsletter->getSubscribersNumbers($conf->table_email);
header("location:send_mod.php?step=send&begin=0&list_id=$list_id&msg_id=$amsg_id&sn=$num&error=0&from=$from_addr&m_id=$msg_id");
break;
}
?>
|