Hi all, I am having a problem but I am not sure why this Email function is not working. This is my script to send out a short newsletter to some people on the website. It pulls their email address if they have the newsletter feature enabled. When i run the script it says how many emails were sent. But the emails never go thru. I dont get any errors. Currently 9 emails should be sent and It says they were. But the emails never get delivered. If anyone can help me to figure out why the emails are not going thru I would appreciate it much. Thank all.
PHP Code:if(isset($_POST[s1]))
{
//get the subscribers info
$q1 = "select * from news_as 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[NewsID]\">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 d_m_archive set
subject = '$_POST[subject]',
message = '$_POST[message]',
MailDate = '$t' ";
mysql_query($q1) or die(mysql_error());
echo "<center><b>$i emails have been successfully sent!</b></center><br>";
}
//get the subscribers number
$q1 = "select count(*) from news_as 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();
}
?>





Bookmarks