• I use plugin profile-builder for login – registration – recover-password. Despite the correct template in settings/wp better mail + test I do not get template in mail. Only raw text is send.

    Do the plugins need headers?
    What can I do to get it working?

    Here a code block of profile-builder:

    $recoveruserMailMessage1  = sprintf( __('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profile-builder'), $display_username_email, '<a href="'.esc_url( add_query_arg( array( 'loginName' => $requestedUserNicename, 'key' => $key ), wppb_curpageurl() ) ).'">'.esc_url( add_query_arg( array( 'loginName' => $requestedUserNicename, 'key' => $key ), wppb_curpageurl() ) ).'</a>');
                    $recoveruserMailMessage1  = apply_filters( 'wppb_recover_password_message_content_sent_to_user1', $recoveruserMailMessage1, $requestedUserID, $requestedUserLogin, $requestedUserEmail );
    
                    $recoveruserMailMessageTitle1 = sprintf(__('Password Reset from "%1$s"', 'profile-builder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES));
                    $recoveruserMailMessageTitle1 = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoveruserMailMessageTitle1, $requestedUserLogin);
    
                    //we add this filter to enable html encoding
                    add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
                    //send mail to the user notifying him of the reset request
                    if (trim($recoveruserMailMessageTitle1) != ''){
                        $sent = wp_mail($requestedUserEmail, $recoveruserMailMessageTitle1, $recoveruserMailMessage1);
                        if ($sent === false){
                            $message = '<b>'. __( 'ERROR', 'profile-builder' ) .': </b>' . sprintf( __( 'There was an error while trying to send the activation link to %1$s!', 'profile-builder' ), $postedData );
                            $message = apply_filters( 'wppb_recover_password_sent_message_error_sending', $message );
                            $messageNo = '5';

    https://www.ads-software.com/plugins/wp-better-emails/

Viewing 1 replies (of 1 total)
  • Plugin Author Nicolas Lemoine

    (@nlemoine)

    Hi norus,

    The emails look like text only but it’s HTML. See in the code you posted:

    add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));

    Unfortunately, they use create_function to set the email format which is a very bad idea as it creates an anonymous function that can’t be removed with remove_filter.

    I’ll think about adding a “force templating” to match such cases.

Viewing 1 replies (of 1 total)
  • The topic ‘Template is not used at all despite %content% in template’ is closed to new replies.