500 Internal Server Error after partially sending segment Email

Your software
My Mautic version is: latest
My PHP version is: 7.4.33
My Database type and version is: 10.4.20-MariaDB-1:10.4.20+maria~buster-log

Your problem
My problem is: I tried to send a segment Email to about 300 contacts, sending them in batches of 100. The sending bar doesn´t progress and after some time I get the 500 error message. Strange thing is it did send some of the Emails but not all of them. Frequency rule is set to 2 Mails a day, no queue settings where made.

These errors are showing in the log:
[2023-06-20 12:32:47] mautic.ERROR: [MAIL ERROR] Connection to ssl://smtp.buzondecorreo.com:465 Timed Out Log data: >> MAIL FROM: >> RCPT TO: >> DATA << 250 2.1.5 Ok << 354 End data with . !! Connection to ssl://smtp.buzondecorreo.com:465 Timed Out (code: 0) (send); elena.crespo@crespolaw.es {“exception”:“[object] (Swift_TransportException(code: 0): Connection to ssl://smtp.buzondecorreo.com:465 Timed Out\nLog data:\n>> MAIL FROM:\r\n\n>> RCPT TO:\r\n\n>> DATA\r\n\n<< 250 2.1.5 Ok\r\n\n<< 354 End data with .\r\n\n!! Connection to ssl://smtp.buzondecorreo.com:465 Timed Out (code: 0) at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:124, Swift_IoException(code: 0): Connection to ssl://smtp.buzondecorreo.com:465 Timed Out at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:166)”} {“hostname”:“914340.cloudwaysapps.com”,“pid”:25383}

[2023-06-20 12:32:47] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionLost: “An exception occurred while executing ‘SELECT cl.company_id, cl.date_added as date_associated, cl.is_primary, comp.* FROM mkt_companies_leads cl INNER JOIN mkt_companies comp ON comp.id = cl.company_id WHERE cl.lead_id = ?’ with params [“330”]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away” at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 115 {“exception”:“[object] (Doctrine\DBAL\Exception\ConnectionLost(code: 0): An exception occurred while executing ‘SELECT cl.company_id, cl.date_added as date_associated, cl.is_primary, comp.* FROM mkt_companies_leads cl INNER JOIN mkt_companies comp ON comp.id = cl.company_id WHERE cl.lead_id = ?’ with params ["330"]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/914340.cloudwaysapps.com/yqhzaxggag/public_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“914340.cloudwaysapps.com”,“pid”:25383}

Steps I have tried to fix the problem: None

I tried to send the remaining Emails with batch limit 50 and all worked fine. Any idea why it is not working with 100? My server seams to have enough capacity to handle that.