PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have the following code which loops through email addresses and is supposed to send the email to each user....... it is erroring. The variable email addresses are displaying fine in my echo output statement;
$emailquery = "SELECT email_address FROM users";
$emailresult = mysql_query($emailquery) or die ("Query failed");
$numofrows = mysql_num_rows($emailresult);
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($emailresult);
echo $row['email_address'];
mail ("$row", "*** update ***",
"The news has been updated
Please log in a unread messages
This is an automated system message, please do no reply.");
}
I have never used variables for the to address. Here is the error;
Warning: mail(): SMTP server response: 501 Syntax error. Syntax:{RCPT TO:<address> [SIZE=msgSize]} in C:\Audit\add_news2.php on line 392
Warning: mail(): SMTP server response: 501 Syntax error. Syntax:{RCPT TO:<address> [SIZE=msgSize]} in C:\Audit\add_news2.php on line 392
Warning: mail(): SMTP server response: 501 Syntax error. Syntax:{RCPT TO:<address> [SIZE=msgSize]} in C:\Audit\add_news2.php on line 392
mail ($row['email_address'], "*** update ***",
"The news has been updated
Please log in a unread messages
This is an automated system message, please do no reply.");