Reputation: 4495
In my CakePHP web application I'm sending mails and if mail is successfully sent then updating data base field 'mailSent' to true. But How to know that mail is successfully sent or not?
Upvotes: 0
Views: 383
Reputation: 11853
You can use a try catch block to check whether the mail was successfully send or not, you can not detect or check if the mail was successfully delivered to the recipient. That is a different scenario.
try {
if ( $this->Email->send() ) {
// Success
} else {
// Failure, without any exceptions
}
} catch ( Exception $e ) {
// Failure, with exception
}
above is just sudo code you can change variable as you need.
let me know if i can help you more.
Upvotes: 1