Get id of sent email

Hi,

In after_save logichooks I used "$mail = new SugarPHPMailer();" for sending emails

I need to get the ID of email which is sent. I tried to get id from "$mail->id" but its not working

Basically I need to use email_id in this logic (https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.0/Cookbook/Adding_an_Existing_Note_to… )

Any help will be highly appreciable

Regards