dachcom-digital / emailizr
Pimcore Emailizr - 正确创建HTML邮件!
v3.1.0
2024-04-30 08:54 UTC
Requires
- pelago/emogrifier: ^7.0
- pimcore/pimcore: ^11.0
- twig/inky-extra: ^3.0
- twig/twig: ^3.9
Requires (Dev)
- codeception/codeception: ^5.0
- codeception/module-symfony: ^3.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-symfony: ^1.0
- symplify/easy-coding-standard: ^9.0
README
要求
- Pimcore: ^11.0
- PHP: >= 8.1
- Twig >= 3.9
发布计划
安装
"require" : { "dachcom-digital/emailizr" : "~3.1.0", }
将Bundle添加到bundles.php
return [ EmailizrBundle\EmailizrBundle::class => ['all' => true], ];
- 使用inky和内联样式创建有效的邮件标记。
- 在Pimcore编辑模式下尊重可编辑内容。
使用方法
只需扩展emailizr布局
{% extends '@Emailizr/layout.html.twig' %}
这将包含如下标记。你可能需要更改它
{% apply spaceless %}
{{ emailizr_style_collector.add('@EmailizrBundle/public/css/foundation-for-emails/foundation.min.css') }}
{% emailizr_inline_style %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width"/>
{% block headStyles %}
<style type="text/css">
{% autoescape false %}
{{ emailizr_inline_style(emailizr_style_collector) }}
{% endautoescape %}
</style>
{% endblock %}
</head>
{% apply inky_to_html %}
<body>
{% block body %}
<table class="body">
<tr>
<td class="center" align="center" valign="top">
<center>
{% block content %}
{% endblock %}
</center>
</td>
</tr>
</table>
<!-- prevent Gmail on iOS font size manipulation -->
<div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> </div>
{% endblock %}
</body>
{% endapply %}
</html>
{% end_emailizr_inline_style %}
{% endapply %}
服务
如果你需要在自定义上下文中解析值,你可以使用ContentService。
<?php use EmailizrBundle\Service\ContentService; class YourClass { protected ContentService $contentService; public function __construct(ContentService $contentService) { $this->contentService = $contentService; } public function parse($content) { $cssFile = PIMCORE_WEB_ROOT . '/static/css/email.css'; return $this->contentService->checkContent($content, $cssFile, FALSE, TRUE, TRUE); } }
更多信息
升级信息
在更新之前,请查看我们的升级说明!