2016-09-30 71 views
1

我发送了大约3000封有附件的电子邮件。基于这个原因,我使用了快速邮件反锯齿和Throttler插件。但我得到以下错误:如何在yii2中使用Swift_Plugins_AntiFloodPlugin

异常“警予\基地\ UnknownPropertyException”用信息“设置未知属性:警予\ swiftmailer \梅勒::插件”

这里是我的主local.php在那里我有添加插件。

 '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

如前所述hereplugins重点应该是内部transport

'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], 
      ], 
     ], 
    ], 
],