简体   繁体   English

贝宝验证后不发送电子邮件

[英]Not sending email after paypal verification

I have set up IPN properly but still cannot get it to send an email. 我已经正确设置了IPN,但仍然无法通过它发送电子邮件。 Part of my code from ipnlistener.php which I'm assuming is wrong: 我假设来自ipnlistener.php的部分代码是错误的:

$code = md5($_COOKIE["AlphaEmail"]);

$to = $_COOKIE["AlphaEmail"]";
$subject = 'WTL Account Activation;
$message = 'Thank you for your purchase.\n\n http://www.worktheline.org/activate.php?code='.$code.';  $headers = 'From:noreply@worktheline.org' . "\r\n";

mail($to, $subject, $message, $headers);

The code before this segment is copied from here: https://developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/ so I guess I can safely assume that is all correct? 该段之前的代码是从此处复制的: https : //developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/,所以我想我可以肯定地认为这是正确的吗?

Check your web server logs and you should get details about why the mail is failing. 检查您的Web服务器日志,您应该获得有关邮件失败原因的详细信息。

Another thing that can help is testing your IPN script in a browser so that you can see the result on screen (and make sure error reporting is enabled.) 可以帮忙的另一件事是在浏览器中测试IPN脚本,以便您可以在屏幕上看到结果(并确保启用了错误报告)。

To do this you can just create a basic HTML form with the action set to your IPN URL. 为此,您只需创建一个基本HTML表单,并将操作设置为IPN URL。 Add hidden fields that match the names/values of IPN data you expect to get and then you can load it and submit it directly in a browser. 添加与您希望获取的IPN数据的名称/值匹配的隐藏字段,然后可以加载它并直接在浏览器中提交。 This allows you to see the result and can help with troubleshooting. 这使您可以查看结果并可以帮助进行故障排除。

Just keep in mind that when testing that way the IPN will not be verified since it didn't come from PayPal's server, so you'll want to make sure your code logic can handle that accordingly. 请记住,以这种方式进行测试时,由于IPN并非来自PayPal的服务器,因此不会进行验证,因此,您需要确保您的代码逻辑可以相应地进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM