lopezlean / cakephp-gourmet-email
用于快速开发 CakePHP 应用的 Gourmet 电子邮件插件。
v3.1.2
2016-06-18 21:02 UTC
Requires
- cakephp/cakephp: ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.0
This package is auto-updated.
Last update: 2024-09-14 01:20:28 UTC
README
通过添加以下功能使 CakePHP 4 的 Email
功能更加强大:
- 默认电子邮件布局,具有基本样式(安全用于电子邮件)
EmailHelper
,它扩展了HtmlHelper
以自动格式化段落、链接等。
安装
使用 Composer
composer require lopezlean/cakephp-gourmet-email:dev-master
然后需要加载插件。在 Application.php
中,例如:
$this->addPlugin('Gourmet/Email');
使用方法
在你的电子邮件视图中,你现在可以使用 Gourmet/Email.Email
辅助工具
// app/Template/Email/html/welcome.ctp Welcome <?= $user['username'] ?> Please confirm your account by clicking on the link below: <?= $this->Email->link('Confirm account', '/') ?> If for any reason, you are unable to click the link above, copy/paste the following to your browser's address bar: <?= \Cake\Routing\Router::url('/') ?> Thank you for choosing us, Company name <?= $this->Email->image('logo.jpg') ?>
对于 text
版本,你只需要创建相同模板的符号链接。我们将所有 text
模板符号链接到 html
$ ln -s html app/Template/Email/text
现在可以发送电子邮件了
$mailer ->setEmailFormat('both') ->setTo("to@example.com") ->setFrom(['example@example.com' => 'Example']) ->viewBuilder() ->setHelpers(['Html','Gourmet/Email.Email']) ->setLayout('Gourmet/Email.default') ->setTemplate('my_template');
补丁和功能
- 分支
- 修改、修复
- 测试 - 这很重要,所以不要无意中破坏它
- 提交 - 不要修改许可证、todo、版本等。(如果你做了修改,请将它们提升到自己的提交中,这样我在拉取时可以忽略它们)
- 拉取请求 - 主题分支有加分
错误和反馈
http://github.com/lopezlean/cakephp-gourmet-email/issues
许可证
版权所有 (c) 2014, Jad Bitar,并许可于 MIT 许可证。版权所有 (c) 2020, Leandro López,并许可于 MIT 许可证。