• As per a previous thread I have a function to force HTML emails to be used with the plugin. Works like a charm, except for some plaintext emails.

    It strips out the line spaces when a plaintext email is sent. Is there any way to only have it strip spaces out of HTML emails?
    This is what my plaintext emails look like:
    http://screencast.com/t/3BKO9iYm1E

    Here is the function:

    add_action( 'init', 'wpbe_wpmandrill_compatibility_init' );
    
    function wpbe_wpmandrill_compatibility_init() {
    	global $wp_better_emails;
    
    	remove_filter( 'mandrill_payload', array($wp_better_emails, 'wpmandrill_compatibility') );
    
    	// do your own email processing
    	add_filter( 'mandrill_payload', 'wpbe_wpmandrill_compatibility' );
    }
    
    function wpbe_wpmandrill_compatibility( $message ) {
    
        global $wp_better_emails;
    
        // make sure you have the %content% tag in the template
        if ( $wp_better_emails->check_template() ) {
            // clean < and > around text links in WP 3.1
            $message['html'] = $wp_better_emails->esc_textlinks( $message['html'] );
            // make links out of URLs
            $message['html'] = make_clickable( $message['html'] );
            // set template
            $message['html'] = $wp_better_emails->set_email_template( $message['html'] );
            // replace variables
            $message['html'] = apply_filters( 'wpbe_html_body', $wp_better_emails->template_vars_replacement( $message['html'] ) );
        }
    
        return $message;
    }

    Any help is appreciated! Unfortunately, there is no way to make the plugin using plaintext send HTML hence I need to find a solution for this if possible.

    https://wordpress.org/plugins/wp-better-emails/

The topic ‘HTML vs PlainText’ is closed to new replies.