I make API for send email using cakephp. This is my code:
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);
And it show error php_network_getaddresses: getaddrinfo failed: No address associated with hostname. Please help me in this case
The error message indicates that php cannot communicate with the host hostname
- this comes from the configuration for that class :
class EmailConfig {
public $smtp = array(
'host' => 'hostname', // <---
...
);
}
Either it's badly configured, or the domain name does not resolve.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.