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
If these all answers are not working then You can simply use multiple mail function for multiple recipient.
$email_to1 = "firstEmail@demo.com";
$email_to2 = "secondEmail@demo.com";
mail($email_to1, $email_subject, $email_message, $headers);
mail($email_to2, $email_subject, $email_message, $headers);
If you need to add emails as CC or BCC, add the following part in the variable you use as for your header :
$headers .= "CC: sombodyelse@noplace.com".PHP_EOL;
$headers .= "BCC: hidden@special.com".PHP_EOL;
Regards
You can add your receipients to $email_to
variable separating them with comma (,
). Or you can add new fields to headers, namely CC:
or BCC:
and put your receipients there. BCC
is most recommended
This will work:
$email_to = "jhewitt@amleo.com,some@other.com,yet@another.net";
Use comma separated values as below.
$email_to = 'Mary <mary@example.com>, Kelly <kelly@example.com>';
@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 <mary@example.com>', 'Kelly <kelly@example.com>');
foreach($arrEmail as $key => $email_to)
@mail($email_to, $email_subject, $email_message, $headers);
If i understood correct try this one
$headers = "Bcc: someone@domain.com";
or
$headers = "Cc: someone@domain.com";