Issue
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
Solution
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.
Answered By - AD7six
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.