Hi there everyone. I'm really confused about this as I want to email eveyone in my DB when a new Event is created by a member.
I have a test code which I used to make sure it works and it sends to 5 email addresses (which is all of them) in the test table. This works fine. All members with a 0 get the mail.
So I now just took the code and changed the table name (obviously!!) and put it in my live site which has 50 members so far. It now doesn't send any emails??? Not sure why this is as the code is exactly the same (except the table name).
$result = mysql_query("SELECT email FROM membership WHERE send_as_email = '0'");
while ($row = mysql_fetch_array($result)) {
sendMail($row[0]);
}
mysql_free_result($result);
function sendMail($to){
$subject = 'New Event Created;
$message = "Hi there,\n
Just letting you know of a new Event that has been created.\n
Title: $title\n
Town: $town\n
Date: $date_convert\n
For more details or to attend this Event, please login \n
Many thanks\n
The Team\n
\n
****************************************************************************\n
THIS EMAIL IS AUTOMATED. DO NOT REPLY.\n
To turn notifications off, change the notification settings in your Profile.\n
****************************************************************************\n";
$headers = 'From:
[email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}