到目前为止,这是common/config/main-local.php
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'in-v3.mailjet.com',
'username' => 'myUsername',
'password' => 'myPass',
'port' => '465',
'encryption' => 'ssl',
],
如何在发送电子邮件时设置超时限制?
我没有提到在Yii2中设置邮件发送超时。
提前致谢。
答案 0 :(得分:0)
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'in-v3.mailjet.com',
'username' => 'myUsername',
'password' => 'myPass',
'port' => '465',
'encryption' => 'ssl',
'timeout' => 2000 //in second
],
它在vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php::setTimeout()
上,您可以通过
\yii\helpers\VarDumper::dump(Yii::$app->mailer->transport->getTimeout(),10,1);