Skip to content

Instantly share code, notes, and snippets.

@jimfloss
Created January 30, 2018 17:57
Show Gist options
  • Save jimfloss/0fc134d5fb948587edfdf222283a15d3 to your computer and use it in GitHub Desktop.
Save jimfloss/0fc134d5fb948587edfdf222283a15d3 to your computer and use it in GitHub Desktop.
Programmatically send a New User WooCommerce email
<?php
$woocommerce_customer_new_account_settings = get_option('woocommerce_customer_new_account_settings');
$user_pass = 'generated_password';
$user_login = 'user_name';
$email = 'user_email@email.com';
$blogname = 'user_name';
$password_generated = 'generated_password';
require_once( '/www/wp-content/themes/theme-name/woocommerce/emails/customer-new-account.php' );
$email_content = ob_get_clean();
$mailer = WC()->mailer();
$mailer->send( $email, $woocommerce_customer_new_account_settings["subject"], $mailer->wrap_message( $woocommerce_customer_new_account_settings["subject"], $email_content ), '', '' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment