承接 unclecheese/silverstripe-permamail 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

unclecheese/silverstripe-permamail

Composer 安装命令:

composer require unclecheese/silverstripe-permamail

包简介

Adds database storage of emails and CMS definition of email templates.

README 文档

README

====================== This module adds several enhancements to the core Email class in SilverStripe:

  • Persisting sent emails in the database
  • Allowing "resend" of emails
  • Providing user-defined HTML templates for emails
  • Send test emails, populated with your specific variables
  • Send emails to a DataList of Members

Installation

composer require unclecheese/silverstripe-permamail:dev-master

Requirements

  • SilverStripe 3.1.*
  • unclecheese/reflection-templates
  • unclecheese/gridfield-betterbuttons:1.2.*

Usage

By default, Permamail is injected as the class for Email, meaning Email::create() will instantiate a Permamail object instead of Email. Because Permamail is a subclass of Email, the API is exactly the same.

If you would like to use Permamail on a case-by-case basis, simply use new Permamail() and new Email() where you see fit, or override the injector setting in the configuration so that Email is the class used for Email.

Example

$e = Email::create()
 	->setFrom('me@example.com')
 	->toMembers(Member::get())
 	->setSubject('Test email')
 	->setUserTemplate('my-template')
 	->populateTemplate(array(
 		'Member' => Member::get()->byID(2)
 	))
 	->send();

The API is exactly the same, with only two new methods:

  • toMembers() accepts an array or SS_List of Member objects and uses their Email properties, sending an email to each one.
  • setUserTemplate() accepts a string as the identifier of a user-defined template in the CMS. More information in the "Administration" section below.

The admin interface

Permamail provides a new ModelAdmin interface called Email, which provides two tabs:

Outbound Emails

Shows a list of all emails sent. Offers an option to resend.

screenshot

screenshot

Email templates

Allows creation of user-defined templates, with default subjects and "From" addresses.

screenshot

Sending test emails

screenshot

Every user-defined template can send a test email, and populate the template with the variables you have specified. To do this, the template uses the ReflectionTemplate class to gather all the variables and blocks in the template, and offers you the opportunity to customise what values are assigned to those variables. Options include:

  • A static value (e.g. hardcoded)
  • A random object from the database of a given ClassName
  • A specific object from the database of a given ClassName

screenshot

Querying specific records to inject into your template

To run a custom query, you can use a query string like an array is used in the filter() method of the ORM, for example: Category=gardening&Title:StartsWith=A&Created:LessThan=2014-11-11

Questions you may have

What if I'm using a custom mailer, like Mandrill, or SendGrid?

No worries. This module doesn't override the mailer. It just overrides the Email class that wraps the Mailer.

What about when the error logger sends out emails. I don't want to persist those to the database.

The error logger does not use the Email class unless you're unit testing. True errors are sent via simple PHP mail().

Won't this pollute the database? My site sends a lot of email.

For maintenance, use the PermamailCleanupTask. It accepts two parameters:

  • unit: the unit of time to go back
  • count: the number of units to go back

/dev/tasks/PermamailCleanupTask?count=30&unit=days will remove all emails that are more than 30 days old.

unclecheese/silverstripe-permamail 适用场景与选型建议

unclecheese/silverstripe-permamail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.85k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2014 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「email」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 unclecheese/silverstripe-permamail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 unclecheese/silverstripe-permamail 我们能提供哪些服务?
定制开发 / 二次开发

基于 unclecheese/silverstripe-permamail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 14.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 4
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-12-02