I wrote some code to send confirmation email to user in model, within afterUpdate(). I want to add an entry into database after sending the email. So I wrote the block this way
public function **afterUpdate()**
{
......
..........
......
$sent = $mail->send($message, $subject, $this->Users->email, $this->Users->name);
if($sent){
$this->aprv_email_sent = 1;
$this->update();
}
}
}
Unfortunately that wasn't working. I know I can update through beforeUpdate(). But I want to send email after updating main records into database.
Please advice me.