承接 eseperio/yii2-email-accounts-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

eseperio/yii2-email-accounts-manager

最新稳定版本:1.0.5

Composer 安装命令:

composer require eseperio/yii2-email-accounts-manager

包简介

Use and manage multiple email accounts in a single yii2-project

README 文档

README

Use and manage different email accounts under the same project. Features methods to live test the configuration and ensure it is correct.

Features

  • Manage multiple email accounts
  • SMTP + IMAP configuration
  • SMTP + IMAP live test
  • Autodiscover SMTP and IMAP settings (when available)

Installation

The preferred way to install this extension is through composer.

composer require eseperio/yii2-email-accounts-manager

ext-simplexml is required for autodiscover feature, but has not been required within composer.json so you can use the library without autodiscover

Add the migration path to your console config:

return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@vendor/eseperio/yii2-email-accounts-manager/src/migrations',
            ],
        ],
    ],
];

Add the module to your app modules configuration

return [
    'modules' => [
        'email-manager' =>[
            'class'=> \eseperio\emailManager\EmailManagerModule::class,      
            'showImapSettings' => false, // change if you need imap settings to be shown,
            // 'mailer'=> 'mailer',
            // 'transport => ['class' => 'Swift_SmtpTransport'],
        ],
       
    ]
]

Usage

Important: This module will replace the current transport for the mailer defined and it does not restore to previous value. 
If you want to prevent this use a different mailer component for this module.

This module includes methods for checking whether the email account is valid and for sending emails using the given configuration.

The EmailAccount model includes useful methods, like getTransport() and setAsMainTransport().

getTransport() returns the transport configuration based on configuration defined within module and the account itself.

setAsMainTransport() will set the transport configuration for the mailer component defined in the module configuration and will return the mailer instance. compose($view='',$params=[]) will return a new message instance preconfigured with the transport configuration for the account and also setFrom defined with the account address.

Sending an email from a custom account

use eseperio\emailmanager\models\EmailAccount;

$account = EmailAccount::findOne(1)->compose('test', ['message' => 'Hello world!'])->setTo('someaddress@example.com')->send();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-01