mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-06 14:58:19 +08:00
30 lines
738 B
PHP
30 lines
738 B
PHP
|
<?php
|
||
|
|
||
|
class ConvertHeadersStylesPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||
|
{
|
||
|
public function Init()
|
||
|
{
|
||
|
$this->addHook('filter.result-message', 'FilterResultMessage');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param \MailSo\Mail\Message &$oMessage
|
||
|
*/
|
||
|
public function FilterResultMessage(&$oMessage)
|
||
|
{
|
||
|
if ($oMessage)
|
||
|
{
|
||
|
$sHtml = $oMessage->Html();
|
||
|
if ($sHtml && 0 < strlen($sHtml))
|
||
|
{
|
||
|
include_once __DIR__.'/CssToInlineStyles.php';
|
||
|
|
||
|
$oCSSToInlineStyles = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($sHtml);
|
||
|
$oCSSToInlineStyles->setEncoding('utf-8');
|
||
|
$oCSSToInlineStyles->setUseInlineStylesBlock(true);
|
||
|
$oMessage->SetHtml($oCSSToInlineStyles->convert().'<!-- convert-headers-styles-plugin -->');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|