get_error_message(); } }; $headers = array(); if ( '' !== (string) $reply_to && is_email( (string) $reply_to ) ) { $headers[] = 'Reply-To: ' . $reply_to; } add_filter( 'wp_mail_from_name', $from, 99 ); add_action( 'wp_mail_failed', $note ); $sent = wp_mail( $to, (string) $subject, (string) $body, $headers ); remove_action( 'wp_mail_failed', $note ); remove_filter( 'wp_mail_from_name', $from, 99 ); if ( ! $sent && '' === self::$error ) { self::$error = __( 'El servidor de correo del sitio rechazó el envío.', 'cumpleconsent' ); } return (bool) $sent; } }