symbiote / silverstripe-mailcapture

一个模块,用于开发/预发布系统,用于在仓库中捕获电子邮件而不是实际发送给用户。然后可以在CMS中浏览这些电子邮件。

安装 : 1,031

依赖关系: 0

建议: 0

安全性: 0

星星: 9

关注者: 2

分支: 11

开放问题: 5

类型: silverstripe-module

3.0.2 2019-09-12 01:28 UTC

This package is not auto-updated.

Last update: 2024-09-21 00:34:31 UTC


README

Build Status

一个模块,用于捕获数据对象中的外部电子邮件,然后用户可以直接在CMS中查看这些电子邮件。

对于处于开发状态(或在测试/预发布服务器上)的网站很有用,其中用户需要能够使用发送电子邮件的功能,但又不希望这些电子邮件真正发送给收件人。

此模块默认不发送电子邮件,但支持通过外部邮件发送器发送,这可以通过yml进行配置,例如

---
Name: mymailcapture
after: mailcapture
---
SilverStripe\Core\Injector\Injector:
  SilverStripe\Control\Email\Mailer:
    class: Symbiote\MailCapture\Control\Email\CaptureMailer
    properties:
     # Set to FALSE to enable pass through of emails without logging
      recordEmails: TRUE
     # Set to TRUE to send emails, uses the configured SwiftMailer
      sendMailOutbound: TRUE

Composer 安装

SilverStripe 3.X

composer require symbiote/silverstripe-mailcapture:~2.0

SilverStripe 4.X

composer require symbiote/silverstripe-mailcapture:~3.0

需求

  • PHP 7.0+
  • SilverStripe 4.0+

破坏性变更

当从SilverStripe 3.x升级到SilverStripe 4.x时,yml文件的语法和功能已更改。例如,此yml配置将记录每封电子邮件的副本,并使用默认的Mailer对象通过SMTP发送电子邮件

---
Name: mymailcapture
after: mailcapture
---
Injector:
  Mailer:
    class: CaptureMailer
    properties:
      outboundMailer: %$MailerObject
      # Set to false to enable pass through of emails without logging
      captureEmails: TRUE
  MailerObject:
    class: Mailer

新语法中的相同功能如下所示

---
Name: mymailcapture
after: mailcapture
---
SilverStripe\Core\Injector\Injector:
  SilverStripe\Control\Email\Mailer:
    class: Symbiote\MailCapture\Control\Email\CaptureMailer
    properties:
     # Set to FALSE to enable pass through of emails without logging
      recordEmails: TRUE
     # Set to TRUE to send emails, uses the configured SwiftMailer
      sendMailOutbound: TRUE

captureEmails 现在是 recordEmails,这去除了有歧义的捕获词,使设置的意图更清晰。outboundMailer不再使用,因为CaptureMailer类现在使用为网站配置的SwiftMailer传输。要启用外部发送电子邮件,我们设置sendMailOutbound