Email all subscribers when i do an action
I've created this function:
function email_subscribed_users($event)
{
$users = get_users('role=subscriber');
foreach ($users as $user) {
$accepted = get_user_meta($user-ID, 'accepted', true);
if ($accepted) {
wp_mail($recipients, $event-event_title, $event-event_desc, 'From: [email protected]');
}
}
}
But it requires a lot of time sending the emails knowing that the users will increase by time.What function should I use to send the emails efficiently or there is a newsletter plugin to do this?
Topic newsletter wp-mail subscription Wordpress
Category Web