PHP Send-Mail form to multiple email addresses

前端 未结 3 1059
醉话见心
醉话见心 2021-01-14 09:38

I\'m very new to PHP and am using a basic template \'send-mail\' form on a contact page. It\'s been requested that I send the email out to multiple email addresses when the

3条回答
  •  时光取名叫无心
    2021-01-14 10:03

    You implode an array of recipients:

    $recipients = array('jack@gmail.com', 'jill@gmail.com');
    
    mail(implode(',', $recipients), $submit, $message, $headers);
    

    See the PHP: Mail function reference - http://php.net/manual/en/function.mail.php

    Receiver, or receivers of the mail.

    The formatting of this string must comply with » RFC 2822. Some examples are:

    • user@example.com
    • user@example.com, anotheruser@example.com
    • User
    • User , Another User <anotheruser@example.com>

提交回复
热议问题