PHP code example of floor12 / yii2-module-mailing

1. Go to this page and download the library: Download floor12/yii2-module-mailing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

floor12 / yii2-module-mailing example snippets

  
'modules' => [
        'mailing' => [
            'class' => 'floor12\mailing\Module',
            'editRole' => 'admin',
            'layout' => '@app/views/layouts/columns',
            'fromEmail' => '[email protected]',
            'fromName' => 'Служба рассылок сайта example.com',
            'htmlTemplate' => 'mailing-main',
            'domain' => 'https://aexample.com',
            'linkedModels' => [
                \common\models\User::class,
                \common\models\Clients::class,
            ]
        ],
        'files' => [
            'class' => 'floor12\files\Module',
        ],
    ],
    ...
  
class User extends MyActiveRecord implements IdentityInterface, MailingRecipientInterface
{

    public static function getMailingList(): array
    {
        return self::find()->select('fullname')->indexBy('id')->column();
    }

    public static function getMailingLabel(): string
    {
        return "Пользователи";
    }

    public function getMailingEmail(): string
    {
        return $this->email;
    }
    ...