0
我收到了用於發送基本電子郵件的代碼。但對於SMTP,我不能完善這個:使用cakephp通過smtp發送電子郵件
function send(){
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'mypassword',
);
$this->Email->delivery='smtp';
$this->Email->send = 'debug';
$this->Email->to = '[email protected]';
$this->Email->subject = 'hurrah';
// $this->Email->replyTo = '[email protected]';
$this->Email->from = 'Charmaine Khay Sorila<[email protected]>';
//$this->Email->send('Here is the body of the email Chams Email Test');
//Set the body of the mail as we send it.
//Note: the text can be an array, each element will appear as a
//seperate line in the message body.
if ($this->Email->send()) {
$this->Session->setFlash('Simple email sent');
} else {
$this->Session->setFlash('Simple email not sent');
$this->set('smtp_errors', $this->Email->smtpError);
}
}
}
我得到這個工作,而不$這個 - >的電子郵件 - >快遞=「SMTP」;但是當我加入這一行,沒有電子郵件,可以在所有發送:(
您正在使用調試選項,嘗試將其刪除 – yossi
同樣的事情yossi ..實際發生的是頁面加載了幾秒鐘,然後它不會發送任何電子郵件... :( – Charmie
第一:你得到了什麼錯誤? – yossi