У меня есть код для отправки основного электронного письма. но для 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);
}
}
}
я получил эту работу без $ this-> email-> доставка = «SMTP» ;, но когда я добавил эту строку, не электронная почта не может быть отправлено на всех :(
вы используете опцию отладки, попробуйте удалить его – yossi
То же самое, что и yossi .. что на самом деле происходит, когда страница загружается за несколько секунд, тогда она не отправит никаких сообщений по электронной почте ... :( – Charmie
первая: какая ошибка (ы), которую вы получаете? – yossi