## Sending bulk mail to a certain number of users

Question

For a project we are developing, we would like to send bulk mail to the user list using wp_mail function.

Is it possible to send e-mail to users at a certain times as in the newsletter plugins? For example; Let’s divide the list of 100 users into 10 groups of 10 people each. Is it possible to send mail to 10 groups with 5 minute intervals?

To give an example instead of theoretical:

We would like to automatically email users who have added “Technology” category to their favorites whenever they post a new post in this category.

How can we edit a function like this to do this?

add_action( 'transition_post_status', 'new_post_notice', 10, 3 );
function new_post_notice( $ID,$post ) {

if ( 'publish' === $new_status && 'publish' !==$old_status ) {

$to = //All users who have added "technology" categories to their favorites$subject = 'A new post has been published!';
$message = 'E-mail body.'; wp_mail($to, $subject,$message, \$headers );

}
}


Can the sleep() function be used to do this?

0
2 years 2019-12-24T13:16:36-05:00 0 Answers 89 views 0