When our WordPress installation sends out lots of emails at the same time some of them get dropped. As we attach unsubscribe links to the bottom of each email each one has to be sent individually. There is a wp_mail filter that looks like the following.

If we send just a small number of emails they normally get sent without problems but when sending out 100 or more emails the problem becomes more apparent. In the last couple of 105 email bates the total sent was 94 and then 96 with seemingly random ones disappearing, if we make the loop wait an interval between sending emails they all get sent. This is a solution but we would like to know what the problem in the hope of resolving it and allowing emails to go as fast as the system will allow.

add_filter('wp_mail', 'wp_mail_filter', 10, 1);

function wp_mail_filter( $args ) {
    $to = $args['to'];

    // Multiple recipients resend as individual emails
    if (is_array($to)) {
        foreach($to as $recipient)
            wp_mail( $recipient, $args['subject'], $args['message'], $args['headers'], $args['attachments']);
    } else {

        $message = 'Custom message based on user associated with address';
        $new_wp_mail = array(
                'to'          => $to,
                'subject'     => $args['subject'],
                'message'     => $message,
                'headers'     => $args['headers'],
                'attachments' => $args['attachments'],

            return $new_wp_mail;

    // Arrive here from multiple mails, send blank
    return array('to' => '', 'subject' => '', 'message' => '');

Read more here: WordPress dropping some emails when sending bulk individual emails


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: