Error sending an email CakePHP -
Error sending an email CakePHP -
i "unknown email configuration 'gmail' " error , while trying send email using cakephp ,is because i'm sending localhost (xampp) ?
if($this->user->save($this->request->data)){ $message='click on link below finish registration '; $confirmation_link='www.sitename.com/users/verify/t:'.$hash.'/n:'.$this->data['user']['username'].''; app::uses('cakeemail', 'network/email'); $email = new cakeemail('gmail'); $email->email->from = 'myemail@gmail.com'; $email->email->to=$this->data['user']['email']; $email->email->subject = 'confirm registration'; $email->email->smtpoptions = array( 'host' => 'ssl://smtp.gmail.com', 'port' => 465, 'username' => 'myemail@gmail.com', 'password' => 'mypassword', 'transport' => 'smtp' ); $email->send($message . " " . $confirmation_link); $this->session->setflash(__('you should activate account')); } }
in order utilize new cakeemail('gmail')
have config gmail
in configure file (/config/email.php) such as:
public $gmail = [ 'transport' => 'mail', 'from' => 'you@localhost', //'charset' => 'utf-8', //'headercharset' => 'utf-8', ];
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
new cakeemail('gmail')
read gmail
config , not have configure in application.
if configuration in application, perhaps utilize new cakeemail();
email cakephp
Comments
Post a Comment