bertoost/craft-ssmtpmailer

Craft 3 CMS 插件,用于添加 sSMTP 邮件发送器(sendmail 的替代品)。

安装: 991

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:craft-plugin

1.0.2 2018-09-18 11:20 UTC

This package is auto-updated.

Last update: 2024-09-29 00:32:34 UTC


README

此邮件发送器适用于 Craft CMS 3,是 Sendmail 的简单替代品,使用 sSMTP。

有关 sSMTP 的更多信息,请访问此处

安装插件

使用 Craft 插件商店或使用 composer

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require bertoost/craft-ssmtpmailer

# OR only for development
# composer require bertoost/craft-ssmtpmailer --dev

# tell Craft to install the plugin
./craft install/plugin ssmtpmailer

执行命令

此适配器直接使用 Swiftmailer Sendmail 传输。它扩展了它,并仅替换了要执行的命令。

以下命令用于 sSMTP 发送您的邮件。

/usr/sbin/ssmtp -t

仅配置开发环境

从 Craft 3 开始,您可以在 config/ 文件夹中的每个配置文件中使用多环境配置。

要仅为开发环境设置此邮件发送器,您可以在多环境配置中更改 config/app.php,并仅配置 sSMTP 邮件发送器以供开发使用。

return [
    // general for every environment
    '*' => [
        'modules' => [
            // ...
        ],
        'bootstrap' => [
            // ...
        ],
    ],

    // Staging environment settings
    'staging' => [
        // ...
    ],

    // Dev environment settings
    'dev' => [
        'components' => [
            'mailer' => function() {
                // Get the stored email settings
                $settings = Craft::$app->getSystemSettings()->getEmailSettings();
                $settings->transportType = bertoost\ssmtpmailer\mail\Ssmtp::class;
                $settings->transportSettings = [];

                return craft\helpers\MailerHelper::createMailer($settings);
            },
        ],
    ],
];