当我将测试服务器的所有代码都放到实时服务器上时,发送电子邮件时出错了。
{ "message": "Network is unreachable", "url": "\/api\/users\/emailSheets", "code": 500, "file": "domainname.com/vendor\/cakephp\/cakephp\/src\/Network\/Socket.php", "line": 179 }
直播服务器有什么问题?
在我的app.php
中'EmailTransport' => [
'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'localhost',
'port' => 25,
'timeout' => 30,
'username' => 'user',
'password' => 'secret',
'client' => null,
'tls' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
'gmail'=> [
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'my@gmail.com', //your gmail address
'password' => '123453', //your gmail password
'className' => 'Smtp',
'log' => true,
'context' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]
],
]