3

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 ?

9

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.

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.