Use three short sentences of code to close WordPress's built-in email notification of registration, password modification, and write a simple welcome email notification function yourself.
preface
Registration Notice
Password modification email
-
Unless those who think their website is awesome
code
add_filter( 'password_change_email', '__return_false' );// Close password modification user email add_filter( 'wp_new_user_notification_email_admin', '__return_false' );// Close the new user registration webmaster email add_filter( 'wp_new_user_notification_email', '__return_false' );// Close the mail of new user registration user
-
It's that simple
Custom Welcome Message
Welcome mail code
function git_register_mail( $user_id ) { $user = get_user_by( 'id', $user_id ); $user_pass = $_POST['password']; $blogname = get_option('blogname'); $message = '<div class="emailcontent" style="width:100%;max-width:720px;text-align:left;margin:0 auto;padding-top:80px;padding-bottom:20px"><div class="emailtitle"><h1 style="color:#fff; Background: # 51a0e3; line height: 70px; font size: 24px; font weight: 400; padding left: 40px; margin: 0 ">Notification of successful registration</h1><div class=" emailtext "style=" background: # fff; padding: 20px 32px 20px "><div style=" padding: 0; font weight: 700; color: # 6e6e6e; font size: 16px ">Dear '$ user->user_login.', Hello</ div><p style="color:#6e6e6e; Font size: 13px; line height: 24px ">Welcome to register ['. $blogname.'], here is your account information, please keep it properly</ p><table cellpadding="0" cellspacing="0" border="0" style="width:100%; Border top: 1px solid # eee; border left: 1px solid # eee; color: # 6e6e6e; font size: 16px; font weight: normal "><thead><tr><th colspan=" 2 "style=" padding: 10px 0; border right: 1px solid # eee; border bottom: 1px solid # eee; text align: center; background: # f8f8f8 ">Your detailed registration information</th></tr></head><tbody><tr><td style=" padding: 10px 0; Border right: 1px solid # eee; border bottom: 1px solid # eee; text align: center; width: 100px ">Log in to email</td><td style=" padding: 10px 20px 10px 30px; border right: 1px solid # eee; border bottom: 1px solid # eee; line height: 30px ">'$ user->user_email.'</td></tr><tr><td style="padding:10px 0; Border right: 1px solid # eee; border bottom: 1px solid # eee; text align: center ">Login password</td><td style=" padding: 10px 20px 10px 30px; border right: 1px solid # eee; border bottom: 1px solid # eee; line height: 30px ">'$ user_pass.'</td></tr></tbody></table><p style="color:#6e6e6e; Font size: 13px; line height: 24px ">If your account is abnormal, please contact us at the first time at '. get_bloginfo ('admin_email'). '</ p></div><div class="emailad" style="margin-top:4px"><a href="'.home_url().' "><img src=" http://reg.163.com/images/secmail/adv.png " alt="" style="margin:auto; width:100%;max-width:700px;height:auto"></a></div></div></div>'; $headers = "Content-Type:text/html;charset=UTF-8\n"; Wp_mail ($user ->user_email, '['. $blogname. '] Welcome to register'$ blogname, $message , $headers); } add_action( 'user_register', 'git_register_mail');
-- 完 --