This topic is locked

Troubleshooting Table Events

4/10/2008 5:46:04 PM
PHPRunner General questions
powersitedesign author

I wrote a class catalog / registration application w/ PHPR a little while back and it's working great w/ the exception of my table event not sending an email after a record is added. I have racked my brain trying to figure out why this isn't working. It's not hosted on one of my servers so I don't have easy access to check the mail quee to see if the messages are getting hung up there although I have had the server admin that is hosting the site check this for me and he didn't see the messages hung in the quee.
Here's the weird part, occasionally the registration process will send an email out and then most of the time it won't? I have had another developer check behind me and we can't think of anything else that could be wrong, anyone have any tips we might try for troubleshooting this app?
Here's a copy of my table events that I have setup after a record is added...
[codebox]// Parameters:

// $values - Array object.

// Each field on the Add form is represented as a 'Field name'-'Field value' pair

// $keys - Array object with added record key column values
//** Redirect to another page ****

header("Location: http://www.anurturingtouch.com/confirmation.php");;)

exit();
// ** Send simple email ****
$email="steph@anurturingtouch.com.com";

$message="New Registration has been made on your website, please login and retrieve their information, http://www.anurturingtouch.com/cms";

$subject="New Registration";

mail($email, $subject, $message);[/codebox]
As you can see I also have a redirect setup in the table events and it's working just fine...

Any suggestions as to where I might look to find this bug?
Thanks for your help in advance!

J
Jane 4/11/2008

Hi,
I recomend you to send email before redirecting.

Also to check sending emails use IF condition:

// ** Send simple email ****

$email="steph@anurturingtouch.com.com";

$message="New Registration has been made on your website, please login and retrieve their information, http://www.anurturingtouch.com/cms";

$subject="New Registration";

if (mail($email, $subject, $message))

echo "email was sent";

else

echo "error";
//** Redirect to another page ****

header("Location: http://www.anurturingtouch.com/confirmation.php");;)

exit();

powersitedesign author 4/11/2008

Thanks Jane! That did the trick!