Noptin_Mailer::inline_css( string $content )

Inlines CSS into the email to make it compatible with more clients.


Parameters Parameters

$content

(string) (Required) The email content.


Top ↑

Source Source

File: includes/class-noptin-mailer.php

	public function inline_css( $content ) {

		// Check if this is PHP 5.6
		if ( version_compare( phpversion(), '5.6', '<' ) ) {
			return $content;
		}

		// Maybe abort early;
		if ( ! class_exists( 'Pelago\Emogrifier\CssInliner' ) || ! $this->inline_css ) {
			return $content;
		}

		try {

			$emogrifier = Pelago\Emogrifier\CssInliner::fromHtml( $content );
			return $emogrifier->inlineCss()->render();

		} catch ( Exception $e ) {

			log_noptin_message( $e->getMessage() );
			return $content;

		}

	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation