Skip to main content
1 of 2
kaiser
  • 50.8k
  • 27
  • 150
  • 244

You'll need something like the following (maybe-working example code):

$users = /* receive array of user objects here */;
foreach ( $users as $user )
{
    $user_email_addresses[] = $user->email; // receive array of user mail addresses here
}

function wpse28212_send_delayed_bulkmail( $email_addresses )
{
    $i = 0;
    foreach ( $user_email_addresses as $email_addy )
    {
        ++$i; // count users up

        $delay = 0; // in miliseconds (ms)

        if ( $i >= 500 )
        {
            $delay = 3600000; // 1 hour
        }
        sleep( $delay );

        wp_mail( $email_addy, 'subject', 'message' );
    }
}

Links:

kaiser
  • 50.8k
  • 27
  • 150
  • 244