I create a functional PHP in WordPress. when publishing an article i send it to our subscribers. i have in DB in addition 1000 email subscriber but when i execute the function it sends only 300 emails.
add_action( 'publish_post', 'wp_post_published_notification', 10, 2 );
function wp_post_published_notification( $ID, $post ) {
$img=get_the_post_thumbnail( $ID, 'full' );
$link=get_permalink($ID);
$title=$post->post_title;
if($title && $img)
{
global $wpdb;
$list_email = $wpdb->get_results("SELECT * FROM `wp_es_emaillist` ");
$content="............";
$subject="............";
$headers="............";
foreach ( $list_email as $email )
{
wp_mail($email,$subject,$content,$headers);
}
}
}