I am sending the birthday wishes email to all the users whose birthday is on the current date and also in the next 07 days.
But the email body is not picking up the first name of the user to whom that email is being sent.
The email body just says: Hello
Rather it should say: Hello {first name}
The code is:
<?php
$query_birth = mysql_query("select email_address from table_name where DATE_ADD(birth_date, INTERVAL YEAR( CURDATE( ) ) - YEAR(birth_date) + IF( DAYOFYEAR( CURDATE( ) ) > DAYOFYEAR(birth_date) , 1, 0 ) YEAR ) BETWEEN CURDATE( ) AND DATE_ADD( CURDATE( ) , INTERVAL 7 DAY )");
$count_birth = mysql_num_rows($query_birth);
if(!empty($count_birth)) {
while($row_birth = mysql_fetch_array($query_birth)) {
$headers = 'From: admin@example.com' . "\r\n";
$message = 'Hello '.$row_birth['user_first_name'].'';
mail($row_birth['email_address'], 'Happy Birthday', $message, $headers);
}
}
?>
Not sure what mistake I have done?