In order for a script to send mail successfully, the following requirements must be met: - a valid email address, which exists on the server (i.e. in cPanel >> Email Accounts) must be used in the script's From field; - proper SMTP authentication must be used by the script, using the aforementioned email account's login credentials for authenticating; - domain must be using our server for its mail and the script must localhost as the mail server.
Alternatively please use a service such as Mandrill (free)