php - Paypal IPN and mail() function -


update: (2/29/12) okay, i've run same issue again different client on different server , hosting company.

again, having script mail() sends out email correctly no issues. added code similar have below , hooked paypal ipn. every time new payment comes in, ipn fires, data gets saved db mail() function doesn't work.

however, ran interesting issue. did test ipn fire paypal's sandbox same script , email sent out.

is issue paypals production ipn, perhaps way posts data script?

any information here extremely helpful since current solution using cronjobs sloppy.

end update

i have paypal ipn listener configured since writes information db when new payment comes in. i'm trying setup mail() function sends me email alert of new payment.

i have done before project can't life of figure out why it's not working time. i'm not getting error's in error_log , rest of script runs fine.

i've tested make sure server send mail standalone mail() script. i'm lost , confused here.

here's code have:

mail('test@email.com', 'new order', 'new order', 'from: support@website.com');  define("_valid_php", true); require_once('../php/init.php');  $item_number = $_post['item_number']; $payment_gross = $_post['payment_gross']; $payment_status = $_post['payment_status']; $payer_email = $_post['payer_email']; $txn_id = $_post['txn_id'];  if ($payment_status == 'completed') {     $query = $db->query("select price, id, uid invoice md5='$item_number'");     $row = $db->fetch($query);     $iid = $row['id'];     $uid = $row['uid'];      if ($row['price'] == $payment_gross){         $invoiceupdate['paid'] = 1;         $update = $db->update('invoice', $invoiceupdate, "md5='$item_number'");     } }      $data['iid'] = $iid; $data['uid'] = $uid; $data['payment_status'] = $payment_status; $data['payer_email'] = $payer_email; $data['payment_gross'] = $payment_gross; $data['txn_id'] = $txn_id;  $db->insert('payment', $data); 

since mail function returns true , code looks correct, think should check mail log because problem might not related code. try send mail , check mail log on server...once lost 2 days trying figure out similar problem , in end problem mail not accepted other servers.

to finde mail log can (from shell):

updatedb; locate mail.log 

or

locate maillog 

this assumes using linux, problem might exists on windows


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -