电子邮件组件 cakephp
第一次使用电子邮件组件...我按照书本说明进行了设置,
function sendNewUserMail($id) {
$User = $this->User->read(null,$id);
$this->Email->to = array('[email protected]');
$this->Email->from = '[email protected]';
$this->Email->subject = 'Welcome to our really cool thing';
$this->Email->template = 'simple_message';
$this->Email->sendAs = 'text';
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'auth' => true,
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'*********'
);
$this->set('User', $User);
$this->Email->delivery = 'smtp';
$this->Email->send();
$this->set('smtp_errors', $this->Email->smtpError);
}
我尝试运行该方法,但没有任何反应...我创建了布局、元素,然后将 var $component = array( '电子邮件');
我收到此错误
无法找到套接字传输“ssl” - 您是否忘记启用 当你配置PHP时它?:16
顺便说一句,我在家,所以没有防火墙,没有阻止等
First time using the email component... I followed the book instruction and I set this
function sendNewUserMail($id) {
$User = $this->User->read(null,$id);
$this->Email->to = array('[email protected]');
$this->Email->from = '[email protected]';
$this->Email->subject = 'Welcome to our really cool thing';
$this->Email->template = 'simple_message';
$this->Email->sendAs = 'text';
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'auth' => true,
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'*********'
);
$this->set('User', $User);
$this->Email->delivery = 'smtp';
$this->Email->send();
$this->set('smtp_errors', $this->Email->smtpError);
}
I try to run the method, but nothing happens... I created the layouts, the elements, and put var $component = array('Email');
I'm getting this error
Unable to find the socket transport "ssl" - did you forget to enable
it when you configured PHP?: 16
by the way I at home so no firewalls, no blocking etc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Gmail smtp 需要安全连接,并且您的 PHP 配置似乎未启用 ssl。打开 php.ini 并查找类似
or 的
行并取消注释(删除 ; 或 #),然后重新启动 PHP。
如果您在那里找不到这样的行,您可能需要先安装 OpenSSL。
Gmail smtp requires a secure connection and it looks like your PHP configuration doesn't have ssl enabled. Open php.ini and look for a line that looks like
or
and uncomment it (remove the ; or the #), then restart PHP.
If you can't find such line there you may need to install OpenSSL first.