2016-05-05 7 views
1

私はyii2フレームワークを使用しています。私はweb.phpのfile.itにスピーディーなメーラーを実装しています。SMTPサーバーの問題swift mailer

私のconfigコード:

'mailer' => [ 
     'class' => 'yii\swiftmailer\Mailer', 
     'useFileTransport'=>false, 
     'transport' => [ 
      'class' => 'Swift_SmtpTransport', 
    ``   'host' => 'smtp.gmail.com', 
      'username' => '[email protected]', 
      'password' => 'TECHEDGE', 
      'port' => '465', 
      'encryption' => 'ssl', 
     ], 
    ], 

しかし、私は、サーバー側で同じことを実行していたときに問題を抱えて、私は以下にレスポンスを得た:

期待応答コード250をが、コード「535」を持って、メッセージ「535-5.7.8でユーザー名とパスワードが受け入れられない 535 5.7.8 https://support.google.com/mail/answer/14257 k8sm2888892qke.45には、こちらをご覧ください - 。gsmtp

任意の助けのおかげ..

答えて

0

のconfigure以下のような迅速なメーラー:

'mailer' => [ 
      'class' => 'yii\swiftmailer\Mailer', 
      'viewPath' => '@common/mail', 
      'useFileTransport' => false,//set this property to false to send mails to real email addresses 
     //comment the following array to send mail using php's mail function 
     'transport' => [ 
      'class' => 'Swift_SmtpTransport', 
      'host' => 'smtp.gmail.com', 
      'username' => '[email protected]', 
      'password' => 'TECHEDGE', 
      'port' => '587', 
      'encryption' => 'tls', 
         ], 
      // 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. 
     ], 

https://www.google.com/settings/security/lesssecureappsに行き、私は上記のコード使用していますが、私は無効なパスの別名で応答を得た安全性の低いアプリの

+0

のアクセスをオンにする:共通/メール@。 –

+0

テンプレートを使用していない場合は、その行を削除できます。 'viewPath' => '@ common/mail'、localhostには – jithin

+0

があります。サーバー側には問題ありません。メールはありませんlesssecureappはtrunです。 –