CakePHP Sending Email - LAMPP

老子叫甜甜 提交于 2019-12-11 09:18:00

问题


I am attempting to send an email using Cake's 'Email' component. I have included the component into my controller and I am using the following code to try send an email.

$this->Email->from = 'Glecto <noreply@glecto.com>';
$this->Email->to = 'gary@glecto.com';
$this->Email->replyTo = 'noreply@glecto.com';
$this->Email->subject = 'Let\'s get started!';
$this->Email->delivery = 'mail';
$this->Email->send('Thank you for signing up');

I've also checked my php.ini to ensure the SMTP setting are set up correctly.

Can anyone spot anything wrong that I'm doing here?


回答1:


/* SMTP Options */
$this->Email->smtpOptions = array(
'port'=>'25',
'timeout'=>'30',
'host' => 'your.smtp.server',
'username'=>'your_smtp_username',
'password'=>'your_smtp_password',
'client' => 'smtp_helo_hostname'
);
/* Set delivery method */
$this->Email->delivery = 'smtp';
/* Do not pass any args to send() */
$this->Email->send();
/* Check for SMTP errors. */
$this->set('smtp_errors', $this->Email->smtpError);


来源:https://stackoverflow.com/questions/7348064/cakephp-sending-email-lampp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!