私のYii2アプリケーションでは、私はswiftで電子メールを送信する連絡フォームを持っています。Yii2 smtpエラー500 5.5.1コマンドが認識されない
私はこのように自分のアプリケーションを構成した:
ものはweb.phpで構成されている:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// 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' => 'authsmtp.myhost.com',
'username' => 'username',
'password' => '************',
'port' => '25',
'encryption' => 'tls',
],
],
、これは私がメールを送信する私のコントローラの一部です:
01:Expected response code 220 but got code "500", with message "500 5.5.1 command unrecognized"
if($contact->load($post) && $contact->validate())
{
Yii::$app->mailer->compose('request',['contact' => $contact ])
->setFrom('[email protected]')
->setTo('[email protected]')
->setSubject('This is a test email')
->send();
return $this->redirect(['login/index']);
}
は、私はこのエラーでSwift_TransportExceptionを受け取ります
swiftによって生成されたエラーに関する詳細情報を取得する方法はありますか? このメッセージはあまりにも一般的です。ログ使用yii\swiftmailer\Logger
のためにすべてのヘルプ
SSL/TLSを使用するSMTPは、通常、ポート465または587を使用します。サーバーはポート25でtlsを使用するように設定されていますか? – topher
こんにちは、あなたの返事をありがとう。プロバイダの指示によると、ドメインのsmptをポート25に設定するとします。 – giovaZ
それから '暗号化せずに送信してみてください。 – topher