Support » Plugin: wpMandrill » Different line feed settings for HTML and plain text emails

  • My site sends out some plain text emails (e.g. password resets) and some HTML (e.g. Gravity Forms).

    This is causing a problem in that the Replace all line feeds ("\n") by <br/> in the message body? setting needs to be on for plain emails but off for HTML, otherwise the HTML emails have huge empty gaps in them.

    Is there a way I can achieve this using the mandrill_payload filter?

    Many thanks

    http://wordpress.org/plugins/wpmandrill/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author MC_Will

    (@mc_will)

    Hi,

    We just released a new version of this plugin. We added a new filter, mandrill_nl2br, that allows you to change that flag on the fly.

    For example:

    function forgotMyPasswordEmails($nl2br, $message) {
        if ( in_array( 'wp-retrieve_password', $message['tags']['automatic'] ) ) {
            $nl2br = true;
        }
        return $nl2br;
    }
    add_filter( 'mandrill_nl2br', 'forgotMyPasswordEmails' );

    Let me know how it goes.

    Hi!

    I am having a similar problem. Your example above works if we have knowledge of tags of the outgoing message, but most of the time, we do not have such information beforehand. In such cases, all we have is if the message to be sent is text-only or has html part as well.

    For example WP notification emails are all text-based by default. I tried setting up a filter on ‘mandrill_payload’. In the filter, I checked if $message[‘html’] is set to ascertain whether the email was text-only or not. Unfortunately, it appears that text-based or not, $message[‘html’] always contains the body of the message and $message[‘text’] is always empty. Please fix the plugin so that $message[‘html’] is empty for text-only emails and populated otherwise. So that we can do necessary operations within the mandrill_payload filter hook.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different line feed settings for HTML and plain text emails’ is closed to new replies.