2011-05-08 55 views
1

,當我在調試和錯誤日誌tmp中沒有什麼 檢查我嘗試搜索了同樣的問題,並按照他們可是不行的CakePHP的電子郵件組件不起作用

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 = '[email protected]@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'); 
    } 

}

回答