How to send an email confirmation to the registered user through Wordpress?

Asked

Viewed 648 times

2

I have this registration routine and need to send an email confirmation when the user registers, how can I do?

// SETUP NEW USER
$data = array(
    'display_name'  => esc_attr($_POST['display_name']),
    'user_login' => esc_attr($_POST['user_login']),
    'user_email' => esc_attr($_POST['email']),
    'user_pass'  => esc_attr($_POST['user_pass']),
    'game_pass'  => esc_attr($_POST['game_pass']),
    'role'       => get_option('default_role'),
);

$new_user = wp_insert_user($data);
wp_new_user_notification($new_user, $user_pass);

1 answer

1


To email with WP you can do this way:

<?php
$to = "[email protected]";
$subject = "Learning how to send an Email in WordPress";
$content = "WordPress knowledge";

$status = wp_mail($to, $subject, $content);

only add your logic as needed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.