2016-09-30 6 views
1

첨부 파일이있는 약 3000 개의 이메일을 보냈습니다. 이런 이유로 저는 AntiFlood와 Throttler 플러그인을 신속하게 사용하고 있습니다. 여기yii2에서 Swift_Plugins_AntiFloodPlugin을 사용하는 방법

내가 가진 내 주요-local.php 파일입니다 : 'YII \ swiftmailer \ 메일러는 :: 플러그인 알 수없는 속성을 설정'메시지

예외 'YII의 \ 기본 \의 UnknownPropertyException'그러나 나는 다음과 같은 오류를 얻고있다 추가 된 플러그인. herepluginstransport 내부해야 언급 한 바와 같이

 'mailer' => [ 
     'class' => 'yii\swiftmailer\Mailer', 
     'viewPath' => '@common/mail', 
     // send all mails to a file by default. You have to set 
     // 'useFileTransport' to false and configure a transport 
     // for the mailer to send real emails. 
     'useFileTransport' => false, 
     'transport' => [ 
          'class'   => 'Swift_SmtpTransport', 
          'host'   => 'mail.test.com', 
          'username'  => '[email protected]', 
          'password'  => '[email protected]', 
          'port'   => '25', 
          //'encryption' => 'tls', 
         ], 
     'plugins'=> [ 
         [ 
          'class' => 'Swift_Plugins_ThrottlerPlugin', 
          'constructArgs' => ['20'], 
         ], 
         [ 
          'class' => 'Swift_Plugins_AntiFloodPlugin', 
          'constructArgs' => [30,45], 
         ], 
        ], 
    ], 

감사

답변

1

:

'mailer' => [ 
    'class' => 'yii\swiftmailer\Mailer', 
    'viewPath' => '@common/mail', 
    'useFileTransport' => false, 
    'transport' => [ 
     'class'   => 'Swift_SmtpTransport', 
     'host'   => 'mail.test.com', 
     'username'  => '[email protected]', 
     'password'  => '[email protected]', 
     'port'   => '25', 
     'plugins'=> [ 
      [ 
       'class' => 'Swift_Plugins_ThrottlerPlugin', 
       'constructArgs' => ['20'], 
      ], 
      [ 
       'class' => 'Swift_Plugins_AntiFloodPlugin', 
       'constructArgs' => [30,45], 
      ], 
     ], 
    ], 
],