Customizing email function
-
Hello,
I am trying to customize emails sent to the user.
I would like to add our website logo but I can’t really figure out how. Do I have to set the content type to text/html for the image to work?
And should I create a plugin for this or can I keep it in the functions.php file?So far this is what I got. and this is placed in the functions.php file in my child theme:
add_filter( 'wp_new_user_notification_email', 'edit_user_notification_email', 10, 4 ); function edit_user_notification_email( $wp_new_user_notification_email, $user, $blogname ){ //Subject $new_subject_txt = __( 'Information about username and password'); //Message $new_msg_txt = sprintf(__( 'Hello and welcome to our website! You have been assigned an education on our e-learning platform. Your username is: %s'), $user->user_email ) . "\r\n"; $key = get_password_reset_key( $user ); if ( is_wp_error( $key ) ) { return; } $new_msg_txt .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n"; $new_msg_txt .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n"; $wp_new_user_notification_email['subject'] = $new_subject_txt; $wp_new_user_notification_email['message'] = $new_msg_txt; return $wp_new_user_notification_email; }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Customizing email function’ is closed to new replies.