i got a code working for sending basic email. but for smtp, i could not perfect this:
function send(){
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'host' => 'ssl://smtp.gmail.com',
'username'=>'csorila@gmail.com',
'password'=>'mypassword',
);
$this->Email->delivery='smtp';
$this->Email->send = 'debug';
$this->Email->to = 'csorila17@gmail.com';
$this->Email->subject = 'hurrah';
// $this->Email->replyTo = 'noreply@example.com';
$this->Email->from = 'Charmaine Khay Sorila<noreply@example.com>';
//$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);
}
}
}
i got this working without $this->Email->delivery='smtp';, but when i added that line, no email can be sent at all :(
If you do not want to actually send an email and instead want to test out the functionality, you can use the following delivery option:
Copy to Clipboard
$this->Email->delivery = 'debug';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.