blueways/bw-email 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

blueways/bw-email

Composer 安装命令:

composer require blueways/bw-email

包简介

TYPO3 extension for sending responsive email templates

README 文档

README

This is the offical documentation of the bw_email extension.

About

You can use this extension to send whole pages or any other element that has a TCA definition.

The templates are parsed with Zurb Foundation Inky. You can use the Inky markup in your fluid templates to generate the table markup needed for most mail clients.

Installation

  • Require via composer composer require blueways/bw-email
  • Activate in Extension Manager
  • Include static TypoScript template

Templates

The extensions offers some default templates located in ÈXT:bw_email/Resources/Private/Templates. You can override the templates by setting the paths via constants:

plugin.tx_bwemail {
    view {
        templateRootPath =
        partialRootPath =
        layoutRootPath =
    }
}

Default mail settings

To register new templates, use TypoScript setup:

plugin.tx_bwemail {
    settings {
        # Remove all default templates
        templates >
        templates {
            TemplateFileName = Title of Template
        }

        # Default setup
        css = EXT:bw_email/Resources/Public/Css/app.css
        senderAddress = noreply@example.com
        senderName = Example sender name
        replytoAddress =
        subject = Example subject
        template = Default
        showUid = 1
        recipientAddress =
    }
}

Data sources

Right from the start you can send single Emails to an email address from inside the email wizard. If you like to send emails to multiple people, you can create a Email data source entry and select one of the following build-in connectors:

  • fe_users
  • CSV file (upcoming)

Usage in other extensions

You can use the Blueways\View\EmailView in your own extension to render responsive email HTML with Inky syntax. It works just like the StandaloneView.

Extend

You can use the DataSource-Provider or create your own ContactProvider.

DataSource model

If you like to configure your source via Backend, you can use the existing DataSource model. Create your own Model by extending the ContactSource Model and implement the getContacts() method.

Don't forget to register the inheritance via typoscript:

config.tx_extbase.persistence.classes {
    Blueways\BwEmail\Domain\Model\ContactSource {
        subclasses {
            Vendor\Extension\YourModel = Vendor\Extension\YourModel
        }
    }

    Vendor\Extension\YourModel.mapping {
        recordType = Vendor\Extension\YourModel
        tableName = tx_bwemail_domain_model_contactsource
    }
}

ContactProvider service

If you like to use external data, you can write your own ContactProvider. Just extend from Blueways\BwEmail\Service\ContactProvider and register the class via Hook:

Known issues

  • CSS files need to be hard coded in email template (see Default.html)
  • Inline RTE links are wrapped with an additional <p></p> that causes line breaks
  • Internal links may be broken

Usage in other content elements

It is possible to use the email wizard in other content elements like Textmedia or News: Just add an element with the TCA-RenderType "sendMailButton". Here is an example of how to add a Send Mail button to tt_content elements:

// TCA/Overrides/tt_content.php
<?php

$tempColumns = [
    'mail_button' => [
        'label' => 'Send this tt_content',
        'config' => [
            'type' => 'passthrough',
            'renderType' => 'sendMailButton',
        ],
    ]
];

ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);
ExtensionManagementUtility::addToAllTCAtypes(
    'tt_content',
    'mail_button',
    '',
    'before:CType'
);

The current record will be available in the Fluid Template as {record}.

To inject additional elements or override default settings you can use the tableOverrides TypoScript setting.

plugin.tx_bwemail {
    settings {
        subject = Default subject in all places
        tableOverrides {
            tt_content {
                subject = New subject
                recipientName = FIELD:header
                typoscriptSelects {
                    latestNews {
                        table = tx_news
                        select {
                            pidInList = 3
                            orderBy = sorting
                            max = 3
                        }
                    }
                }
            }
        }
    }
}

With the typoscriptSelects setting you can insert records to the email template. In the example above, you can display the latest news records with <f:for each="{latestNews}" as="news">{news.title}</f:for>.

Todo

  • Better translations
  • Better default template organisation
  • Absolute URL handling for new v9
  • Move provider settings to TypoScript

Improvement ideas

  • embed images in message
  • separate backend module
  • send mail log
  • sass compiler for Foundation for Email

blueways/bw-email 适用场景与选型建议

blueways/bw-email 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.9k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 blueways/bw-email 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2019-02-01