dispatch( $type, (int) $booking_id ); if ( false === $ok ) { delete_transient( $marker ); if ( (int) $attempt < 1 ) { $failed[] = array( $type, (int) $booking_id, 1 ); } } } self::$running = false; global $phpmailer; if ( is_object( $phpmailer ) && method_exists( $phpmailer, 'smtpClose' ) ) { $phpmailer->smtpClose(); } // One retry a couple of minutes later for anything that failed. if ( $failed ) { wp_schedule_single_event( time() + 2 * MINUTE_IN_SECONDS, 'seatt_mail_batch', array( $failed ) ); } } }