Yii2 SMTP服务器问题swift mailer
我正在使用yii2框架,并在我的web.php文件中实现swift-mailer。它工作得很好 我的配置代码:Yii2 SMTP服务器问题swift mailer,yii2,Yii2,我正在使用yii2框架,并在我的web.php文件中实现swift-mailer。它工作得很好 我的配置代码: 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'useFileTransport'=>false, 'transport' => [ 'class' => 'Swift_SmtpTransport', ``
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport'=>false,
'transport' => [
'class' => 'Swift_SmtpTransport',
`` 'host' => 'smtp.gmail.com',
'username' => 'testdemomail32@gmail.com',
'password' => 'TECHEDGE',
'port' => '465',
'encryption' => 'ssl',
],
],
但当我在服务器端实现相同的东西时,我遇到了问题,我在下面得到了响应:
预期响应代码为250,但收到代码“535”,消息“535-5.7.8用户名和密码不被接受。了解更多信息,请访问
535.7.8 K8SM288892QKE.45-gsmtp
任何帮助,谢谢。如下所示配置swift mailer:
'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' => 'testdemomail32@gmail.com',
'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.
],
转到并打开不太安全的应用程序的访问权限如下所示配置swift mailer:
'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' => 'testdemomail32@gmail.com',
'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.
],
转到并打开对不太安全的应用程序的访问我正在使用上述代码,但收到无效路径别名的响应:@common/mail.ok如果不使用模板,您可以删除该行。“viewPath'=>'@common/mail',在localhost中运行良好。但在服务器端没有电子邮件,lesssecureapp处于开启状态。但是如何在中启用lesssecureapps服务器在您的服务器中使用相同的smtp配置?lesssecureapps使用gmail设置。首先,您登录用于smtp的邮件并启用lesssecureapps。我正在使用上述代码,但在无效路径别名中得到响应:@common/mail。确定如果不使用模板,您可以删除该行。localhost i中的“viewPath”=>“@common/mail”工作正常。但在服务器端没有电子邮件。lesssecureapp是trun打开的。但如何在服务器中使用相同的smtp配置启用lesssecureapps?lesssecureapps使用gmail设置。首先,登录用于smtp的邮件并启用lesssecureapps。