承接 silverstripers/custom-emails 相关项目开发

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

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

silverstripers/custom-emails

Composer 安装命令:

composer require silverstripers/custom-emails

包简介

Send fully configurable custom emails from Silverstripe

README 文档

README

Installation

Use composer to install the module.

composer require silverstripers/custom-emails

Configuration

Define your emails first in YAML files and run a dev build. The emails objects will be created in the CMS (Siteconfig). You can have multiple emails defined with different identifiers.

Once you go in the CMS and configure them you can start sending emails.

---
name: notifications-config
---
SilverStripers\CustomEmails\Dev\Injector:
  definitions:
    EMAIL_IDENTIFIER:
      name: 'Title of the email'
      dynamic: true # for emails which doesnt need a to address
      template: '' # Silverstripe template file to use when rendering emails. 
      arguments: # merge tags
        - Name
        - Email

###Sending emails

To send an email you can use the Processor classs.

use SilverStripers\CustomEmails\Model\NotificationEmail;

$processor = NotificationEmail::get_processor(
    'EMAIL_IDENTIFIER',
    'to@email.com',
    'from@email.com',
    [
        'Name' => 'Name',
        'Email' => 'test@test.com'
    ]
);
$processor->setAttachments([
    'file_name' => $content
]);
$processor->send();

The functions above can be used as this.

use SilverStripers\CustomEmails\Model\NotificationEmail;

NotificationEmail::get_processor('EMAIL_IDENTIFIER')
    ->setTo('to@email.com')
    ->setFrom('from@email.com')
    ->setData([]) // data as you specify on your merge tags
    ->setAttachments([
        'file_name' => $content
    ])->send();

统计信息

  • 总下载量: 363
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-03-05