tomkirsch/html_email
Composer 安装命令:
composer require tomkirsch/html_email
包简介
Library for CI4
README 文档
README
Composer Install
composer require tomkirsch/html_email
Add the service to Config\Services
public static function htmlEmail(array $emailConfig=[], bool $getShared=TRUE){
return $getShared ? static::getSharedInstance('htmlEmail', $emailConfig) : new \Tomkirsch\HtmlEmail\HtmlEmail($emailConfig);
}
Use it.
$htmlEmail = service('htmlEmail', ['protocol'=>'mail']); // you can pass an array for CI's email->initialize() if you'd like.
$htmlEmail
->setSubject('A Test Email for YOU!')
->section($htmlEmail::SECTION_PREHEADER)
->p('This is the preheader. It shows up in email previews (sometimes), but not the body.')
->section($htmlEmail::SECTION_BODY)
->p('Well Hello There!', [
'text-align'=>'center',
'font-size'=>'20px',
'font-weight'=>'bold',
])
->p('This is a test email that uses HTML standard from 1992, because email applications cannot get their shit together. Hopefully this looks the same in most programs.')
->pStart(['text-align'=>'center'])
->a([
'url'=>'https://google.com',
'label'=>'Plain Link',
])
->pEnd()
->pStart(['text-align'=>'center'])
->btn([
'url'=>'https://google.com',
'label'=>'Button',
'align'=>'center',
])
->pEnd()
->p('You can make button groups that are horizontal.')
->btnGroup([
'urls'=> ['https://google.com', 'https://bing.com'],
'labels'=>['Button Group 1', 'Button Group 2'],
'dir'=>$htmlEmail::DIR_H,
'align'=>'center',
'width'=>'50%',
'spacer_w'=>10,
])
->p('You can also make button groups that are vertical.')
->btnGroup([
'urls'=> ['https://google.com', 'https://bing.com'],
'labels'=>['Button Group 1', 'Button Group 2'],
'dir'=>$htmlEmail::DIR_V,
'align'=>'center',
'width'=>'50%',
'spacer_v'=>10,
])
->plaintextLine('=')
->p(NULL, [], 'A SECRET MESSAGE FOR PLAINTEXT USERS ONLY!')
->plaintextLine('=')
->section('footer')
->p('You were sent this email because you stupidly signed up for our mailing list. Deal with it.')
->setMessage() // this sets the HTML and plain text (setAltMessage()) content. Pass a view to customize the layout.
;
// you can pass anything through to CI's email lib too
$htmlEmail
->setFrom('me@example.com')
->setTo('you@example.com')
->send();
;
tomkirsch/html_email 适用场景与选型建议
tomkirsch/html_email 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tomkirsch/html_email 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tomkirsch/html_email 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-15