定制 formatd/mailer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

formatd/mailer

Composer 安装命令:

composer require formatd/mailer

包简介

Wrapper for SymfonyMailer in Neos Flow Projects

README 文档

README

A Template Mailer for Neos Flow or/and CMS Projects.

What does it do?

This package provides a service class intended to be used as base class for sending Fluid templates as mails. In addition it contains a debugging aspect for cutting off and/or redirecting all mails (sent by SymfonyMailer) in a development environment. Moreover, it supports using environment variables to build the DSN for the Symfony Mailer.

Kompatiblität

Versioning scheme:

 1.0.0 
 | | |
 | | Bugfix Releases (non breaking)
 | Neos Compatibility Releases (non breaking except framework dependencies)
 Feature Releases (breaking)

Releases und compatibility:

Package-Version Neos Flow Version neos/form Version
3.0.x 9.x >= 6.0.0
2.0.x 8.x >= 6.0.0
1.1.x >= 6.x <= 8.x < 6.0.0
1.0.x 4.x - 5.x < 6.0.0

Using the service in your own plugins to use fluid templates for mails

Configure default from address:

FormatD:
  Mailer:
    defaultFrom:
      address: 'example@example.com'
      name: 'Example'

Extend AbstractMailerService and add methods as needed following the example of sendTestMail().

intersept all mails in a dev environment

Configure swiftmailer to intersept all mails send by your neos installation (not only by the service).

This is an example which intercepts all mails and redirects them to example@example.com and secondexample@example.com:

FormatD:
  Mailer:
    interceptAll:
      active: true
      recipients: ['example@example.com', 'secondexample@example.com']
    bccAll:
      active: false
      recipients: []

Handling Embedded Images

The method AbstractMailerService->setMailContentFromStandaloneView() has a parameter to embed all images into the mail body. This is handy if you have an installation that is protected by a .htaccess file for example, or the user may not have access to the internet when reading the email. GMail also cannot display images if they are included from a local domain.

FormatD.Mailer can be configured to replace all image urls by local paths (if you specify a baseUrl in your flow configuration). This is needed it the server cannot make a web-request to itself (also maybe due to a .htaccess or something).

FormatD:
  Mailer:
    localEmbed: true

Disable embed for specific images

You can disable image embedding for specific images by adding data-fdmailer-embed="disable" as data attribute to the image tag. This is useful for tracking pixels where you dont want the local embedding.

Using environment variables to build a SMTP transport DSN

Use the special DSN fd-mailer in the SymfonyMailer configuration. This transport will then use the configuration given under FormatD.Mailer.smtpTransport to build the actual DSN and actual SmtpTransport object. host is mandatory, all other parts are optional.

For special cases the automatic DSN construction can be omitted by passing the DSN directly at Neos.SymfonyMailer.mailer.dsn.

Neos:
  SymfonyMailer:
    mailer:
      dsn: 'fd-mailer'

FormatD:
  Mailer:
    smtpTransport:
      host: '%env:SMTP_HOST%'
      encryption: '%env:SMTP_ENCRYPTION%'
      port: '%env:SMTP_PORT%'
      username: '%env:SMTP_USERNAME%'
      password: '%env:SMTP_PASSWORD%'
       
      # Optional: Query params appended to the DSN, use with caution and only when necessary
      options:
        # Do not verify server TLS certificate
        verify_peer: 1
        # Do not try `STARTTLS` at all
        auto_tls: 'false'
        # Use `STARTTLS` even when not announced in server capabilities
        require_tls: 'true'
        

The encryption param is cast to boolean, with the 'false' string being interpreted falsy as well. If true, the scheme will be smtps, thus the Symfony SMTP transport tries to establish a TLS encrypted channel right away. If encryption is false, then the transport will still try to upgrade the connection via STARTTLS, when that is announced by the server!

The options config is completely optional and could be omitted to use SymfonyMailer's sane defaults. It can be used to define query parameters appended to the DSN, as described in the SymfonyMailer documentation.

formatd/mailer 适用场景与选型建议

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

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

围绕 formatd/mailer 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-24