I am using wp_mail to send an email to multiple recipients.

my mail function looks like this:

wp_mail($group_emails, 'my subject', 'my message', $headers);

$group_emails is an array of email address's and gets outputed like this:

$group_emails = Array ( [0] => ceri@test.com [1] => craigj@test.com [2] => danyob@test.com [3] => geoffh@test.com [4] => ianc@test.com [5] => mark.butcher@test.com [6] => mickh@test.com [7] => mike@test.com [8] => stephd@test.com [9] => stuartj@test.com )

For some reason the email does not get sent to the above emails? If i remove the multiple recipients and just put a single email address, it works fine!

Any suggestions?

2 Answers 2


There are multiple ways of doing this.

You can consider any of the following.

1.My preferred:

foreach($group_emails as $email_address)
   wp_mail($email_address, 'my subject', 'my message', $headers);

2.Another way

Define the array as follows.

$group_emails = array('ceri@test.com', 'craigj@test.com', 'danyob@test.com', 'geoffh@test.com', 'ianc@test.com', 'mark.butcher@test.com', 'mickh@test.com', 'mike@test.com', 'stephd@test.com', 'stuartj@test.com' );

And then try your regular procedure:

wp_mail($group_emails, 'my subject', 'my message', $headers);

I am not sure about the second way. But the first way will work for sure.


I want to add to what @Rohit has said, you can also send multiple recipients as a comma-separated string.

From the Codex

<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?> 


$to (string or array) (required) The intended recipient(s). Multiple recipients may be specified using an array or a comma-separated string.

Default: None

  • But it does say "string or array" so array should work!
    – trainoasis
    Mar 18, 2021 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.