Skip to content

Instantly share code, notes, and snippets.

@Pirenko
Last active July 16, 2019 10:45
Show Gist options
  • Save Pirenko/48335c4e3fd8a2b9991e73718d7cf975 to your computer and use it in GitHub Desktop.
Save Pirenko/48335c4e3fd8a2b9991e73718d7cf975 to your computer and use it in GitHub Desktop.
// Set up e-mail feature
$to = 'hello@mail.com';
$subject = 'Welcome to our website!';
$headers = array('Content-Type: text/html; charset=UTF-8');
// Get username secret key
$user_info = get_user_by('email', $to );
$login_link='https://www.yourwebsite.com/wp-json/sand_login/prk_route?username='.$to.'&secret='.$user_info->secret_key;
// Create e-mail message
$body = 'Hello!<br />Click on the link below to login:<br /><a href="'.$login_link.'">Click here to login</a>';
// Send e-mail
wp_mail( $to, $subject, $body, $headers );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment