CakePHP发送电子邮件 - LAMPP [英] CakePHP Sending Email - LAMPP

查看:167
本文介绍了CakePHP发送电子邮件 - LAMPP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Cake的电子邮件组件发送电子邮件。我已将组件包含在我的控制器中,我使用以下代码尝试发送电子邮件。

  $ 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');

我也检查了我的php.ini以确保SMTP设置正确设置。 p>

任何人都可以发现我在这里做的任何错误?

解决方案

  / * 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'
);
/ *设置交付方式* /
$ this-> Email-> delivery ='smtp';
/ *不要传递任何参数send()* /
$ this-> Email-> send();
/ *检查SMTP错误。 * /
$ this-> set('smtp_errors',$ this-> Email-> smtpError);


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?

解决方案

/* 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);

这篇关于CakePHP发送电子邮件 - LAMPP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆