Simple Emailing to user while updating case

I have a problem when ever I update case it stucks and does not do further forward and does not send email that I have hardcoded.
Logic hook is given below:

 $hook_array['after_save'][] = Array(13, 'send email', 'custom/modules/Cases/Logic_Hook_Classes/work_flows.php','work_flows', 'work_flows_execute');

It’s code is given below:

 class work_flows{
function work_flows_execute($emailSubject, $emailBody){
		$emailObj = new Email();
		$defaults = $emailObj->getSystemDefaultEmail();
		$mail = new SugarPHPMailer();
		$mail->setMailerForSystem();
		$mail->From = $defaults['email'];
		$mail->FromName = $defaults['name'];
		$mail->ClearAllRecipients();
		$mail->ClearReplyTos();
		$mail->Subject=from_html($emailSubject);
		$mail->Body=$emailBody;
		$mail->AltBody=from_html($emailBody);
		$mail->prepForOutbound();
	
			$mail->AddAddress("fozangill@outlook.com");
		
		@$mail->Send();
		mail("fozangill@outlook.com","sub","mesage");
	}
 }

None of method working.

When you define the hook array, do you initialize the array like so?

$hook_array['after_save'] = Array()

Start by determining if your hook is getting called, log something at the beginning.

Then in your code, you need to get access to your web server log to know which errors PHP is throwing. Check your web server config to find out where it is.

I would start with a simple email, just with constants, without $emailObj (you’re not using it anyway!)

yes its defined above

errors in logs are:::===>>>>>
Fri Jun 15 09:56:06 2018 [32127][18d186db-3231-5dcb-bd2f-5b11a03296a3][FATAL] SugarBean::populateDefaultValues $field_defs should be an array

That particular error has been coming up a lot for everyone, I don’t think it’s your problem.

Pay attention to the timestamps, you want to look at what happens in the logs at the moment your hook is called.