cakephp电子邮件组件不起作用

时间:2011-05-08 19:06:21

标签: email cakephp smtp cakephp-1.3

当我在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 = 'tag601@hotmail.com';
$this->Email->from = 'T@QM@N<tag601@hotmail.com>';
$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'); 
    } 

}

1 个答案:

答案 0 :(得分:0)

看看this tutorial ..我认为这些功能与你的功能类似。

祝你好运!