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