Multiple email recipient using wp_mail()

I want to define multiple recipients email address outside the array. like

$adminmail = get_option(admin_email);
$adminmail2 = like an email address;
$multiple_recipients = array($adminmail,$adminmail2);
$subj = 'The email subject';
$body = 'This is the body of the email';
wp_mail( $multiple_recipients, $subj, $body );

Is this possible ?

1
1

Yes it’s possible, $to accepts an array or comma-separated list of email addresses to send message.

You can read more here, about optional headers parameter that can add from, cc, content-type, fields.

If you want to send automaticaly WordPress admin notifications, you can have a look to this.

Leave a Comment