Getting native SendingMessage entity after sending email

I am using:
emailService.sendEmail(email, caption, body, "text/html; charset=UTF-8",emailAttachment);

for sending some of emails from cuba. I´d like to create realation to SendingMessage entity after recod is created. Is there any way how cvan i acces record UUID or something after sending?

Hi,
You can get these IDs, but you’ll need to change your code a bit.

  1. Create your own service to send email.

  2. Inject com.haulmont.cuba.core.app.EmailerAPI Spring bean to this service. This bean is not eligible for injection in global and web modules, only in core.

  3. Use one of sendEmailAsync() methods - they return list of created SendingMessage entities.