I am working on setting up an automated email response via my PayPal IPN Script, however the following code causes paypal's sandbox to fail.
// PAYMENT VALIDATED & VERIFIED!
$email = $_POST['payer_email'];
$password = mt_rand(1000, 9999);
$to = $email;
$subject = 'Download Area | Login Credentials';
$message = '
Thank you for your purchase
Your account information
-------------------------
Email: '.$email.'
Password: '.$password.'
-------------------------
You can now login at http://yourdomain.com/PayPal/';
$headers = 'From:noreply@yourdomain.com<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script>' . "
";
mail($to, $subject, $message, $headers);
Is there something simplistically wrong with it, or is there a deeper cause for the script to cause an error. Keep in mind, i am new to this, and this is code that i copy and pasted from http://code.tutsplus.com/tutorials/using-paypals-instant-payment-notification-with-php--net-3271.
Also, does the from email i use have to be located on the same server i am using to host the script?
the email is removed to avoid giving out personal information.