cakephp 电子邮件组件不起作用

发布于 2024-11-05 23:23:07 字数 1414 浏览 4 评论 0原文

当我在 tmp 中签入调试和错误日志时,什么也没有 我尝试搜索相同的问题并关注它们,但不起作用

function sendNewUserMail($id) {
     $User = $this->Member->read(null,$id);
      $this->Email->smtpOptions = array(
    'port'=>'465', 
    'timeout'=>'30',
    'host' => 'ssl://smtp.gmail.com',
    'username'=>'*******@gmail.com',
    'password'=>'*******',
  );

  $this->Email->delivery = 'smtp';   
$this->set('smtp_errors',$this->Email->smtpError);
$this->Email->to = $User['Myprofile']['email']; 
$this->Email->subject = 'WelCome To Alltweak.com Just Fun to create and share new registry script';
$this->Email->replyTo = '[email protected]';
$this->Email->from = 'T@QM@N<[email protected]>';
$this->Email->template = 'simple_message'; // note no '.ctp'
$this->Email->sendAs = 'html'; // because we like to send pretty mail
$this->set('Member', $User);
$this->Email->_debug = true;

if ( $this->Email->send('Test Email') ) { 
        $this->Session->setFlash('Simple email sent'); 
    } else { 
        $this->Session->setFlash('Simple email not sent'); 
    } 

}

When i check in debug and error log in tmp not anything
i try to search the same question and follow them but doesn't work

function sendNewUserMail($id) {
     $User = $this->Member->read(null,$id);
      $this->Email->smtpOptions = array(
    'port'=>'465', 
    'timeout'=>'30',
    'host' => 'ssl://smtp.gmail.com',
    'username'=>'*******@gmail.com',
    'password'=>'*******',
  );

  $this->Email->delivery = 'smtp';   
$this->set('smtp_errors',$this->Email->smtpError);
$this->Email->to = $User['Myprofile']['email']; 
$this->Email->subject = 'WelCome To Alltweak.com Just Fun to create and share new registry script';
$this->Email->replyTo = '[email protected]';
$this->Email->from = 'T@QM@N<[email protected]>';
$this->Email->template = 'simple_message'; // note no '.ctp'
$this->Email->sendAs = 'html'; // because we like to send pretty mail
$this->set('Member', $User);
$this->Email->_debug = true;

if ( $this->Email->send('Test Email') ) { 
        $this->Session->setFlash('Simple email sent'); 
    } else { 
        $this->Session->setFlash('Simple email not sent'); 
    } 

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

时光暖心i 2024-11-12 23:23:07

看看本教程 ..我认为这个功能与你的功能类似。

祝你好运!

Take a look of this tutorial.. I think this functions are similar with your functions.

Good Luck!

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