2015-05-22 35 views
0

嗨,我爲我的WordPress網站使用woocommerce插件。當客戶發出新訂單時,電子郵件將發送給他/她的ID,但通知郵件未被管理員接收。我嘗試了不同的代碼和插件,以使這件事情可行。這是我安裝WP-Mail-SMTP,也使用一些代碼像新訂單後,管理員收到郵件沒有郵件 - Woo commerce

function new_customer_registered_send_email_admin($user_login) { 
ob_start(); 
do_action('woocommerce_email_header', 'New customer registered'); 
$email_header = ob_get_clean(); 
ob_start(); 
do_action('woocommerce_email_footer'); 
$email_footer = ob_get_clean(); 

woocommerce_mail(
get_bloginfo('admin_email'), 
get_bloginfo('name').' - New customer registered', 
$email_header.'<p>The user '.esc_html($user_login).' is registered to the website</p>'.$email_footer 
); 
} 
add_action('new_customer_registered', 'new_customer_registered_send_email_admin') 

反正是有這樣做

回答

0

你應該發送郵件與woocommerce郵件功能看下面的代碼,你可以試試

插件
function user_reg($user_login) { 
$subject = 'WC Send Mail Test'; 

// load the mailer 
$mailer = WC()->mailer(); 
$mailer->send(get_option('admin_email'), $subject, $mailer->wrap_message($subject, 'a test message'), '', ''); 

} 
add_action('new_customer_registered', 'user_reg'); 

看到它幫助:)

感謝。

相關問題