定制 riddlestone/brokkr-mail 二次开发

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

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

riddlestone/brokkr-mail

Composer 安装命令:

composer require riddlestone/brokkr-mail

包简介

A Laminas module to provide service-manager built and configured mail transports

README 文档

README

A Laminas module to provide service-manager built and configured mail transports

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

composer require riddlestone/brokkr-mail

Usage

Building a Message

This module adds a factory for generating messages with content created using Laminas View.

// local.config.php

return [
    'view_manager' => [
        'template_path_stack' => [
            __DIR__ . '/../views',
        ],
    ],
];
// some_factory_or_service.php

use Laminas\ServiceManager\ServiceManager;
use Riddlestone\Brokkr\Mail\MessageFactory;

/** @var ServiceManager $serviceManager */

$messageFactory = $serviceManager->get(MessageFactory::class);
$message = $messageFactory(
    'mail/my-html-template',
    'mail/my-text-template',
    [
        'view_variable_1' => 'Some value',
        'view_variable_2' => 'Some other value',
    ],
);

Once created, you will need to set the subject, and other header fields (such as To, From, etc.).

The created message will have two alternate mime-parts: text and HTML. If the text template is omitted, the text will be created from the HTML content.

Building a Transport

This module adds a factory for Laminas\Mail\Transport\TransportInterface which creates it from configuration at mail.transport.

For example, to use a shared SMTP transport:

// local.config.php

return [
    'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.example.com',
                'host' => 'smtp.example.com',
                'connection_class' => 'login',
                'connection_config' => [
                    'username' => 'me@example.com',
                    'password' => 'my-p@ssw0rd',
                ],
            ],
        ],
    ],
];
// some_factory_or_service.php

use Laminas\Mail\Message;
use Laminas\Mail\Transport\TransportInterface;
use Laminas\ServiceManager\ServiceManager;

/** @var ServiceManager $serviceManager */
/** @var Message $message */

/** @var TransportInterface $transport */
$transport = $serviceManager->get(TransportInterface::class);
$transport->send($message);

For more details on the configuration options, see the Laminas Mail Docs.

Get Involved

File issues at https://github.com/riddlestone/brokkr-mail/issues

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固