First: Don’t use mail()
. Use wp_mail()
Use wp_mail()
instead.
wp_mail(
// Send it to yourself
get_option( 'admin_email' ),
'Your subject',
'Your message',
// extra headers
array (
'Bcc:' . implode( ",", $usersarray ),
'From:' . get_option( 'admin_email' )
)
);