I think I could reproduce it.
I guess the nodes FQDN is the same as the mail server hostname.
Setting the nodes FQDN sets an entry in the hosts /etc/hosts:
127.0.1.1 node.domain.tld node
The hosts /etc/hosts is also used in the containers like the apache2-app container of the lamp app. So when the PHPMailer script is executed in the lamp container and it wants to connect to the mail server at node.domain.tld it doesn’t reach it as it connects to 127.0.1.1 which is the lamp container itself and not the mail server.
So I changed the nodes FQDN at the nodes page to another name which adapts the /etc/hosts entry, see Cluster management — NS8 documentation
Be careful to set a name that points to the server to reach it again. In case something went wrong, it should always be possible to reach the cluster admin using the IP.
If you obtained a certificate for the node don’t forget to get a new one.
Then I restarted lamp to use the corrected /etc/hosts:
runagent -m lamp1 systemctl --user restart apache2-app
Now the mail server FQDN was reachable from the lamp app and PHPMailer worked.