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

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -