It is a simple mailing list. I added various emails to the list for testing and it does not send to any of them. It used to work at one stage. It is really old code as you can see. Any ideas how to get this working. Thanks in advance.
<?
require_once("../conn.php");
require_once("access.php");
include_once("LeftStyles.php");
if(isset($_POST[s1]))
{
//get the subscribers info
$q1 = "select * from re2_agents where news = 'y' ";
$r1 = mysql_query($q1) or die(mysql_error());
while($a1 = mysql_fetch_array($r1))
{
$to = $a1[email];
$subject = $_POST[subject];
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/$a1[NewsletterType]; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
if($a1[NewsletterType] == "plain")
{
$message = strip_tags($_POST[message]);
$message .= "\n\n========================\nTo unsubscribe, use this link:\n";
$message .= "$site_url/u.php?id=$a1[AgentID]";
}
else
{
$message = $_POST[message];
$message .= "<br><hr width=\"100%\" size=1 color=black>Click <a href=\"$site_url/u.php?id=$a1[AgentID]\">here</a> to unsubscribe.";
}
$message = stripslashes($message);
mail($to, $subject, $message, $headers);
$i++;
}
//add the message to the mail archive
$t = time();
$q1 = "insert into re2_mail_archive set
subject = '$_POST[subject]',
message = '$_POST[message]',
MailDate = '$t' ";
mysql_query($q1) or die(mysql_error());
echo "<center><b>$i emails was sent!</b></center><br>";
}
//get the subscribers number
$q1 = "select count(*) from re2_agents where news = 'y' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
if($a1[0] == '0')
{
echo "<br><center><font face=verdana size=2 color=red><b>You have no subscribers at your mailing list!";
exit();
}
?>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire