If the email is being delivered successfully to some addresses but not other addresses, the problem will be on the SMTP server, not the emailing script.
It may be that the SMTP server is set to refuse to relay emails to certain domains, you will need to contact the host to have them look into the smtp servers error logs to see why the email is not being relayed to those users.