• After helping a client of mine to debug an issue as to why CSS was being stripped from emails when being sent, I was able to track down the issue being due to invalid CSS being generated in the Kadence_Woomail_Customizer::get_styles_string method, which resulted in an Emogrifier error.

    As just one example, this CSS was being generated/output:

    #body_content_inner table.td{ background-color:;}

    Which is generated from the items_table_background_color setting.

    This is only one of the issues, there’s probably 20 other invalid CSS rules being generated

    The problem is that, the default setting value, is an empty string. So when an empty value is being set for that CSS to be generated, your plugin is still generating the CSS for that element, ultimately resulting in invalid CSS.

    In the Kadence_Woomail_Customizer::get_styles_string method where you loop through each property to generate the CSS, you should probably add a check something like:
    if( $property_value === '' ){ continue; }

    As to not generate invalid CSS properties. I had to manually edit my client’s copy of your plugin to fix this, hopefully you can include a patch for this in the next release to prevent invalid CSS from being generated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tripflex

    (@tripflex)

    After typing all this, and spending a while trying to debug why it was doing this … I instead just switched in my plugin (WP Job Manager Emails) to instead use the internal WooCommerce Emogrifier instead of the version included in my plugin.

    So while this may be something that the WC emogrifier is able to handle, may be a good idea to keep in mind that other emogrifiers may have issues with this (or that this may come up at a later time).

    Please feel free to close this if you would like.

    Thanks for posting, I’ll look into this!
    Ben

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_styles_string generating CSS without valid property values’ is closed to new replies.