Does the other domain have a different i.p. address ??? Could it be a firewall issue i.e. only certain hostnames or i.p. addresses are allowed to connect to the mail server? Is the destination mail server refusing the connection because the i.p. address is not whitelisted?
If the exact same code can connect from one i.p. but not another then its either a firewall issue or the mail server is not set up correctly. Take it up with your host.