500 Internal Server Error [MAIL ERROR] Connection could not be established with host :stream_socket_client():

Your software
My Mautic version is: v4.1.2
My PHP version is: 7.4.30
My Database type and version is: 10.3.34-MariaDB-0ubuntu0.20.04.1

Your problem
My problem is: 500 Internal Server Error

These errors are showing in the log:

[2022-09-14 13:10:06] mautic.ERROR: [MAIL ERROR] Connection could not be established with host :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known Log data: ++ Starting Swift_Transport_EsmtpTransport !! Connection could not be established with host :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known (code: 0) (send); admin@icomco.co {“exception”:“[object] (Swift_TransportException(code: 0): Connection could not be established with host :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known\nLog data:\n++ Starting Swift_Transport_EsmtpTransport\n!! Connection could not be established with host :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known (code: 0) at /home/icomco.co/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:124)”}

[2022-09-14 22:37:38] mautic.NOTICE: PHP Notice - Undefined offset: 1 - in file /home/icomco.co/public_html/app/bundles/EmailBundle/Helper/MailHelper.php - at line 1964 {“idHash”:null,“monitoredEmail”:false,“settings”:{“address”:“”,“host”:“mail.icomco.co”,“port”:“993”,“encryption”:“/ssl/novalidate-cert”,“user”:"admin@icomco.co",“password”:“1K4tyIetmN@eECb+”,“use_attachments”:“”,“folder”:“”},“email”:“”}

[2022-09-14 22:37:38] mautic.CRITICAL: Uncaught PHP Exception Swift_RfcComplianceException: “Address set in PathHeader does not comply with addr-spec of RFC 2822.” at /home/icomco.co/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php line 150 {“exception”:“[object] (Swift_RfcComplianceException(code: 0): Address set in PathHeader does not comply with addr-spec of RFC 2822. at /home/icomco.co/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php:150)”}

Steps I have tried to fix the problem: