我使用cakephp制作发送电子邮件的API。这是我的代码:
App::uses('CakeEmail', 'Network/Email');
$this->autoLayout = false;
$this->autoRender = false;
$data = $this->request->data;
$title = $data['title'];
$content = $data['content'];
$Email = new CakeEmail('smtp');
$Email->from('myemail@gmail.com');
$Email->to($data['email'][0]);
$Email->subject($title);
$Email->send($content);
它显示错误php_network_getaddresses:getaddrinfo failed:没有与hostname关联的地址。在这种情况下请帮帮我
答案 0 :(得分:1)
错误消息表明php无法与主机hostname
通信 - 这来自the configuration for that class:
class EmailConfig {
public $smtp = array(
'host' => 'hostname', // <---
...
);
}
配置错误,或域名无法解析。