php - Send mail to each array value -
i have array $emails. print_r($emails)
output following:
array ( [0] => array ( [user_email] => ) [1] => array ( [user_email] => mail_1@gmail.com ) [2] => array ( [user_email] => mail_2@gmail.com ) )
now want send emails email addresses in array. tried:
foreach($emails $contact) { $to = $contact; $subject = 'the subject'; $message = 'hello'; mail($to, $subject, $message, $headers); }
what is: warning: mail() expects parameter 1 string, array given
foreach($emails $contact) { $to = $contact['user_email']; $subject = 'the subject'; $message = 'hello'; mail($to, $subject, $message, $headers); }
Comments
Post a Comment