PHP form send email to multiple recipients

后端 未结 7 1943
無奈伤痛
無奈伤痛 2020-11-27 05:18

I have some PHP code that I\'m using to send a form off to a specific e-mail address. However, I\'d like to include a couple more e-mail addresses in the PHP for when it sen

7条回答
  •  时光说笑
    2020-11-27 05:39

    Use comma separated values as below.

    $email_to = 'Mary , Kelly ';
    @mail($email_to, $email_subject, $email_message, $headers);
    

    or run a foreach for email address

    //list of emails in array format and each one will see their own to email address
    $arrEmail = array('Mary ', 'Kelly ');
    
    foreach($arrEmail as $key => $email_to)
        @mail($email_to, $email_subject, $email_message, $headers);
    

提交回复
热议问题