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

    (@nlemoine)

    Hi,

    It’s not a bug. Read the description, it explicitly mentions that some requirements have to be met. Especially that emails have to be sent as plain text.

    Turns out WPdicuz sends them as “text/html”, wc.php line 866/867:

    $headers[] = "Content-Type: text/html; charset=UTF-8";
    $headers[] = "From: " . get_bloginfo('name') . "\r\n";

    Besides, they are doing it the wrong way, not using WordPress filters.

    You still force the template wrapping with WP Better Emails by pasting this in your functions.php file:

    add_action( 'phpmailer_init', function( $mailer ) {
    	global $wp_better_emails;
    	$mailer->Body = $wp_better_emails->set_email_template( $mailer->Body );
    	$mailer->Body = $wp_better_emails->template_vars_replacement( $mailer->Body );
    });

    Untested and potentially unwanted effects, use at your own risk.

    Thread Starter wzshop

    (@wzshop)

    Thank you. Sorry, I wasnt trying to say (although i did:)) that it was a bug.. I meant that some conflict ocurred between both plugins. thanks again. I will try your function and provide feedback to wpdiscuz!

    Thread Starter wzshop

    (@wzshop)

    Hi,
    Tried your code. Works really good, but it marks up emails with html twice, if that email is already in html format (hope i made myself clear). So the WP better emails template is applied twice. Is there a way to check if the email needs the function (your solution) or not? Or maybe to check if the mail is sent by wpdiscuz since that is the only plugin that sends emails other than default wp emails.

    Thanks again!

    Thread Starter wzshop

    (@wzshop)

    Ok here is a fix:

    //All mails in html
    add_action( 'phpmailer_init', function( $phpmailer ) {
    	$custmessage = $phpmailer->Body;
    	if ( $phpmailer->ContentType == 'text/html' && strpos($custmessage,'wpdiscuzSubscribeID') !== false)  {
    	global $wp_better_emails;
    	$phpmailer->Body = $wp_better_emails->set_email_template( $phpmailer->Body );
    	$phpmailer->Body = $wp_better_emails->template_vars_replacement( $phpmailer->Body );
    	}
    Plugin Author Nicolas Lemoine

    (@nlemoine)

    Glad you fixed this!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Notification mail not sent with html markup’ is closed to new replies.