wdmg/yii2-mailer

邮件管理器

安装: 491

依赖: 1

建议: 0

安全: 0

星标: 4

关注者: 4

分支: 2

开放问题: 0

类型:yii2-extension

1.4.0 2023-06-29 08:12 UTC

This package is auto-updated.

Last update: 2024-09-29 10:43:47 UTC


README

Yii2 Downloads Packagist Version Progress GitHub license

Yii2 Mailer

Yii2 Mailer

Yii2 的邮件管理器和查看器。

此模块是 Butterfly.СMS 内容管理系统的一个组成部分,但也可以作为一个独立的扩展使用。

版权 (c) 2019-2023 W.D.M.Group, Ukraine

要求

安装

要在控制台安装模块,请运行以下命令

$ composer require "wdmg/yii2-mailer"

配置数据库连接后,在控制台运行以下命令

$ php yii mailer/init

然后选择您想要执行的操作

  1. 应用所有模块迁移
  2. 撤销所有模块迁移
  3. 清除邮件缓存

迁移

在任何情况下,您都可以在控制台运行以下命令以执行迁移并创建初始数据

$ php yii migrate --migrationPath=@vendor/wdmg/yii2-mailer/migrations

配置

要将模块添加到项目中,请在配置文件中添加以下数据

'modules' => [
    ...
    'mailer' => [
        'class' => 'wdmg\mailer\Module',
        'routePrefix' => 'admin'
        'saveMails' => true, // if need save mail after send
        'mailsPath' => '@runtime/mail', // path to save mails
        'trackMails' => true, // if need tracking mail after send
        'trackingRoute' => '/mail', // route to tracking mails
        'saveWebMails' => false, // flag if need save web version of mail`s
        'webRoute' => '/mails', // route to web mails
        'webMailsPath' => '@webroot/mails', // path to save web version of sending mail
        'sendingInterval' => 1, // message sending interval in sec.
        'useTransport' => false, // flag for use transport configuration
        'transport' => [ // default transport configuration
            'class' => 'Swift_SmtpTransport',
            'host' => 'localhost',
            'username' => '',
            'password' => '',
            'port' => '25'
        ],
        'useEncryption' => false, // flag for use encryption in transport
        'encryption' => 'ssl', // default encryption configuration
        'useStreamOptions' => false, // flag for use stream options in transport
        'streamOptions' => [ // default stream options
            'ssl' => [
                'allow_self_signed' => false,
                'verify_peer' => false,
                'verify_peer_name' => false
            ]
        ], 
        'viewPath' => '@app/mail', // views of mail`s messages
        'enableLog' => true // flag for debug
    ],
    ...
],

用法

有关更多详细信息,请参阅 USECASES.md

路由

使用模块的 Module::dashboardNavItems() 方法来生成导航项列表,如下所示

<?php
    echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
        'label' => 'Modules',
        'items' => [
            Yii::$app->getModule('mailer')->dashboardNavItems(),
            ...
        ]
    ]);
?>

状态和版本 [准备使用]

  • v.1.4.0 - 更新版权信息,修复导航菜单
  • v.1.3.6 - 更新 README.md 和依赖项,从控制台清除邮件缓存
  • v.1.3.5 - 更新 README.md 和依赖项