error mail connector unexpected end file from server

Error on mail connector

I'm using Bonita Community 7.9.3

I'm facing a random error on a mail connector.

Sometimes it works ok and the mail is sent ok, and suddenly on a new case of the same process, the connector stays in "executing" for a while and then changes to "failed" (i see this in the portal with the admin user) and the mail is not sent.

This is the error i've found in the logs:

Groovy script throws an exception of type class with message = Unexpected end of file from server