Bean Meeting on Logic Hook

Hi, there,
I created a Logic Hook where to create a new empty Meeting. When saving the Call an error is generated.
I bring back the code of the hook:

class AfterSaveCallLogicHook
         function openMeeting($bean, $event, $arguments)
             //ottengo l'id della lead associata alla chiamata

             // creo uno nuovo meeting
             $meetingBean->name="Nuovo appuntamento3";
             $meetingBean->description="Nuovo appuntamento scaturito da chiamata";

             echo "<pre>";
             echo "</pre>";


I tried the same code in an Entrypoint and it works.
I report the entry point code:

$meetingBean->name="Nuovo appuntamento2";
$meetingBean->description="Nuovo appuntamento scaturito da chiamata";

I report the error of suitecrm.log :

Mon Aug 26 17:49:13 2019 [20300][1][FATAL] SugarPHPMailer encountered an error: Invalid address:  (to): 

Which logic hook it is , before save or after save?

The class name seems to indicate it’s “after save” hook.

I suggest adding more fields, namely all the fields that are “required” when creating a meeting from the UI.

That’s right, it’s an “after save” hook.
I also thought it was a problem related to passing all the required fields… but I do not understand why the same ocode put in file for Entrypoint works ?

Checking the apache errors I found that the problem was on the dates, I passed the start and end dates and the script worked. For those interested I report the portion of code to create a meeting from a hook:

             $meetingBean->name="Nuovo appuntamento4";
             $meetingBean->description="Nuovo appuntamento scaturito da chiamata";
             $meetingBean->date_start='2019-08-28 13:00:00';
             $meetingBean->date_start='2019-08-28 14:00:00';