• Resolved crickw

    (@crickw)


    I have been unsuccessful at getting the plug in to send the html version. Set it all up fine, but the text email is sending only text. Source of the text email:

    Date: Fri, 26 Sep 2014 22:02:07 +0000
    MIME-Version: 1.0
    Content-Type: multipart/alternative; boundary=”_av-nyXveTo9lGRqLTIDMWa7Cg”

    –_av-nyXveTo9lGRqLTIDMWa7Cg
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 7bit

    Hey ! This is a sample email to test your HTML template. If you’re not
    skilled in HTML/CSS email coding, I strongly recommend to leave the default
    template as it is. It has been tested on various and popular email clients
    like Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, and
    many more. If you have any problems or any suggestions to improve this
    plugin, please let me know.
    –_av-nyXveTo9lGRqLTIDMWa7Cg
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: 7bit

    Hey !

    This is a sample email to test your HTML template.

    If you’re not skilled in HTML/CSS email coding, I strongly recommend to leave the default template as it is. It has been tested on various and popular email clients like Gmail, Yahoo Mail, Hotmail/Live, Thunderbird, Apple Mail, Outlook, and many more.

    If you have any problems or any suggestions to improve this plugin, please let me know.<img src=”http://mandrillapp.com/track/open.php?u=30303909&id=45362d304b2142c3b034feb94546ed2e&#8221; height=”1″ width=”1″>
    –_av-nyXveTo9lGRqLTIDMWa7Cg–

    I use wpMandrill and when I send a test e-mail with Mandrill, I also get only plain text:

    Date: Fri, 26 Sep 2014 22:07:00 +0000
    MIME-Version: 1.0
    Content-Type: multipart/alternative; boundary=”_av-6iWncL3u5H2b5yrPqGJVtQ”

    –_av-6iWncL3u5H2b5yrPqGJVtQ
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 7bit

    the is a test
    –_av-6iWncL3u5H2b5yrPqGJVtQ
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: 7bit

    the is a test<img src=”http://mandrillapp.com/track/open.php?u=30303909&id=fcdb1a19e3cc4bdf8feec108782ee42b&#8221; height=”1″ width=”1″>
    –_av-6iWncL3u5H2b5yrPqGJVtQ–

    Do I need to “turn on” HTML somewhere?
    Thanks,
    Crick

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

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

    (@nlemoine)

    Hi crickw,

    There’s no need to turn on “HTML” but your installation have to meet some requirements to get the plugin working fine:
    – emails have to be plain/text
    – third party plugins have to use “wp_mail” native function

    The emails you pasted are not plain/text, they’re “multipart/alternative” meaning they contain both format (html & text plain) and thus can’t be wrapped with the HTML template I provide.

    Regarding wpmandrill, have a look at this topic: https://wordpress.org/support/topic/integration-with-wpmandrill-1?replies=2
    WpMandrill is not using the default WordPress function to send emails.

    By the way, rating one star and saying that “it doesn’t work” wihtout reading the plugin page or support threads (both would have bring answers to your questions) is a little bit unfair in my opinion. The plugin can’t be compatible with the thousands of plugins out there, plus, you should blame wpmandrill as they’re not using the WordPress email native function.

    Nicolas

    Thread Starter crickw

    (@crickw)

    Nicholas,
    Thank you for replying! I understand that third party plugins have to use “wp_mail” native function.
    I found this in the WP Mandrill

    Mandrill: How to send a regular email.

    If you’re a Plugin Developer, and you need to send a regular email using wpMandrill, you don’t need to learn anything else. You can use the good ol’ wp_mail function, as you would normally do if you were not using this plugin.

    For example:

    <?php wp_mail('your@address.com', 'Your subject', 'Your message'); ?>

    Does this mean Mandrill users can use your plug in?
    How would we go about doing so?
    Thanks,
    Crick

    Plugin Author Nicolas Lemoine

    (@nlemoine)

    Hi,

    I just had a deeper look into the wpMandrill plugin. They’re saying you can use wp_mail() function because they overwrite it with their own code. But some hooks that are included in the native function are missing in the wpMandrill one.
    It’s one of these hooks (phpmailer_init) that is used by WP Better Emails to set the template and make everything work. Bad luck.

    Still, they provide a hook that can “replace” (not exactly but it does the job) the missing important one. I finally managed to get everything working with this hook.

    Paste the code above in your functions.php file or a plugin file and that should do the trick (works for me):

    add_filter('mandrill_payload', 'wpbe_wpmandrill_compatibility');
    function wpbe_wpmandrill_compatibility( $message ) {
    	global $wp_better_emails;
    	$message['html'] = nl2br(make_clickable($message['html']));
    	$message['html'] = $wp_better_emails->esc_textlinks($message['html']);
    	$message['html'] = $wp_better_emails->set_email_template($message['html']);
    	$message['html'] = $wp_better_emails->template_vars_replacement($message['html']);
    	return $message;
    }

    Let me know if it works for you.

    BTW, thanks for your revised review. My mistake for the support email, I forgot to update it in the last release. The correct one is: wpbetteremails [ at ] helloni.co. It will be updated in the next release.

    Cheers,

    Nicolas

    Thread Starter crickw

    (@crickw)

    Thanks Nicolas – your rock for doing this. Hope it helps lots of Mandrill users!

    The hook didn’t do the trick for me – but let me caveat that I my understanding of WP and php for that matter are as yet still weak.

    I have a functions.php file in my /wp-content/themes/easynda folder based on the twentytwelve theme. The only code in the file is:

    <?php 
    
    function wpbootstrap_scripts_with_jquery()
    {
    	// Register the script like this for a theme:
    	wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
    	// For either a plugin or a theme, you can then enqueue the script:
    	wp_enqueue_script( 'custom-script' );
    }
    add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
    
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    ?>

    To test your hook, I made sure that both wpMandrill and wpBetterEmails were activated, then inserted the hook as follows:

    <?php 
    
    function wpbootstrap_scripts_with_jquery()
    {
    	// Register the script like this for a theme:
    	wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
    	// For either a plugin or a theme, you can then enqueue the script:
    	wp_enqueue_script( 'custom-script' );
    }
    add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
    
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    
    add_filter('mandrill_payload', 'wpbe_wpmandrill_compatibility');
    function wpbe_wpmandrill_compatibility( $message ) {
    	global $wp_better_emails;
    	$message['html'] = nl2br(make_clickable($message['html']));
    	$message['html'] = $wp_better_emails->esc_textlinks($message['html']);
    	$message['html'] = $wp_better_emails->set_email_template($message['html']);
    	$message['html'] = $wp_better_emails->template_vars_replacement($message['html']);
    	return $message;
    }
    
    ?>

    Something didn’t go right though. With the hook in the file the site would not load at all. Just a blank page.

    If I can help troubleshoot this for WPBE and other Mandrill users, let me know.

    Plugin Author Nicolas Lemoine

    (@nlemoine)

    Looks like you’re having a PHP error somewhere. Weird because I pasted your code in my functions.php and I’m having no errors.

    Try to put some brackets around the register_sidebar function:

    <?php 
    
    function wpbootstrap_scripts_with_jquery()
    {
    	// Register the script like this for a theme:
    	wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
    	// For either a plugin or a theme, you can then enqueue the script:
    	wp_enqueue_script( 'custom-script' );
    }
    add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
    
    if ( function_exists('register_sidebar') ) {
    	register_sidebar(array(
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    }
    
    add_filter('mandrill_payload', 'wpbe_wpmandrill_compatibility');
    function wpbe_wpmandrill_compatibility( $message ) {
    	global $wp_better_emails;
    	$message['html'] = nl2br(make_clickable($message['html']));
    	$message['html'] = $wp_better_emails->esc_textlinks($message['html']);
    	$message['html'] = $wp_better_emails->set_email_template($message['html']);
    	$message['html'] = $wp_better_emails->template_vars_replacement($message['html']);
    	return $message;
    }
    
    ?>

    If you still have a blank page, paste this in your wp-config.php file:

    define('WP_DEBUG', true);
    define('WP_DEBUG_DISPLAY', true);

    It will output PHP errors on your screen. Paste it so I can exactly know what’s going wrong.

    Thread Starter crickw

    (@crickw)

    Nicolas,

    YOU SO ROCK@! :-))

    Plugin Author Nicolas Lemoine

    (@nlemoine)

    You’re welcome.

    Check the changelog of the next release. I might add a builtin support for wpMandrill.

    Plugin Author Nicolas Lemoine

    (@nlemoine)

    Hi Chris,

    I just released an update with the WpMandrill support. If you update the plugin to 0.2.7, please remove the code you pasted in your functions.php file.

    Thread Starter crickw

    (@crickw)

    Thanks a million Nicolas. Update installed and tested.
    crick

    Thread Starter crickw

    (@crickw)

    Nicolas, I do notice that I’m not able to use the password reset feature.

    Wordpres, in this reset password help section, notes:

    But on some hosts, especially when email isn’t working right, sometimes you have to take different steps to reset your password.

    If anyone else runs into this problem and finds it related to enabling wpManrill with wpBetterEmail, please let me know.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘plug in does not sent HTML mail, only text’ is closed to new replies.