I am trying to send an email using the PHP mail function to multiple email addresses selected through a multiple select form without doing a for each loop. I am currently saving the email addresses as an array, but the PHP mail function returns an error saying it only accepts one argument. Any ideas on how to make this work?
I am trying to send an email using the PHP mail function to multiple
Share
I am assuming your select looks something like this:
In that case, the list of e-mail address would be returned as an array to your PHP (note the empty square brackets in the
nameattribute). To send e-mails to all the selected addresses without a loop, you can implode your array with a comma and feed it into the first argument of the PHPmailfunction, like so: