Hey everyone,
I've been trying stuff for a while now, and I just can't find a way to way to fix it.
I have this function to send email to a list of email contained in a MySQL database. Here it is:
PHP Code:set_time_limit(0);
ignore_user_abort();
$send_to = array();
// If its a test, send only to admin's email
if ( isset($test) )
{
$send_to[] = $config['admin_email'];
}
// Else send to all registered users
else
{
$newsletter_data = db_select("SELECT `newsletter_email` FROM `newsletter`");
for ($i = 0; $i < count($newsletter_data); $i++)
{
$send_to[] = $newsletter_data[$i]['newsletter_email'];
}
}
// Fix strings to send in nice HTML
$message = str_replace(array(">", "<", "\"", "&"), array('>', '<', '"', '&'), $message);
// Check if the user chose TEXT ONLY or HTML.
if ($type_value == 'html')
{
$message = stripslashes($message);
}
else
{
$message = '<font face="arial, verdana, helvetica" size="2">' . stripslashes(nl2br($message)) . '</font>';
}
// Prepare message for the newsletter
$subject = stripslashes($subject);
$object = $config['newsletter_title'] . ' (' . date("m.d.y") . '): ' . $subject;
$message = $message . "<br><br>";
// Go through all email in $send_to array and send newsletter
for ($i = 0; $i < count($send_to); $i++)
{
// Add unregister message at the bottom of the message
$unregister_message = '<br><hr align="left" width="150" size="1" noshade><a href="http://www.hymnfromabove.com/~glambert/prod/adviso/desabonnement.php?email=' . $send_to[$i] . '">Cliquez ici pour vous désabonnez</a>';
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$headers .= "From: \"" . $config['newsletter_sender'] . "\" < " . $config['newsletter_email'] . " >\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP / ".phpversion()."\n";
mail("<" . $send_to[$i] . ">", $object, $message . $unregister_message, $headers);
}
Did I miss something? Is something wrong in my code? Or is it possible that my Outlook Express's configuration is ****ed? I've tried with 2 different POP (from 2 diff. ISP) and they don't work.
The mail() function works with hotmail and other free ISP.
PLEASE help a poor soul!
Thanks




Bookmarks