电子邮件组件 cakephp

发布于 2024-10-01 23:16:30 字数 1422 浏览 0 评论 0原文

第一次使用电子邮件组件...我按照书本说明进行了设置,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半衾梦 2024-10-08 23:16:30

Gmail smtp 需要安全连接,并且您的 PHP 配置似乎未启用 ssl。打开 php.ini 并查找类似

;extension=php_openssl.dll

or 的

#extension=openssl.so

行并取消注释(删除 ; 或 #),然后重新启动 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

;extension=php_openssl.dll

or

#extension=openssl.so

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文