PDA

View Full Version : php not sending


padone
06-02-2005, 05:04 PM
Hey guys

I had this php code to send emails when its called from flash and worked sweet untill today just wondered if someone with a bit more php background
could take a look at it and let me know if its broke



<?php
$content="
Hi

$theirname\n

You have been challenged by\n

$yourname\n

to beat their score at : http://www.mydomain.co.uk/index.htm\n

$yourname

Total lap time was\n

$totalrace\n

See if you can do better\n";

mail($theiremail, "Challenge from $yourname", $content, "From: $youremail");

$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );
mail( "$youremail", "Formula 1", "$content", "From:craig@mydomain.com\n" );

$signal=1;
echo "signal=$signal";

?>



and the actionscript to call the php page is



on (release) {
if (signal != 1 && youremail .indexOf("@") != -1 && youremail .indexOf(".") != -1 && theiremail .indexOf("@") != -1 && theiremail .indexOf(".") != -1 && yourname != "" && theirname !="") {
signal=2;
loadVariablesNum ("tellfriend.php", 0, "POST");
_root.clip._visible = 1;
_root.click = 1;
}
if ( youremail .indexOf("@") ==-1 || youremail .indexOf(".") ==-1) {
x2._visible = 1;
}else{
x2._visible = 0;
}
if ( theiremail .indexOf("@") ==-1 || theiremail .indexOf(".") ==-1) {
x3._visible = 1;
}else{
x3._visible = 0;
}
if ( yourname == "" ) {
x1._visible = 1;
}else{
x1._visible = 0;
}
if ( theirname == "" ) {
x4._visible = 1;
}else{
x4._visible = 0;
}
}



The thing is my flash seems to be working becasue when i click send it actually goes to the next stage and says that it sent but no emails come through :confused: :confused:

mmm..pi..3.14..
06-02-2005, 07:01 PM
Try testing your PHP file via a web browser instead of through Flash. If you don't get any errors in the browser, then flash is your problem. If you do, then you'll know what to fix because it will tell you.

padone
06-03-2005, 09:18 AM
when i type

http://www.rathergood.co.uk/content/images/stories/gtkarting/tellfriend.php

it brings

signal=1

mmm..pi..3.14..
06-03-2005, 05:10 PM
Remind me again of the exact problem. Can you send variables to PHP?? Can flash load variables from PHP? Can PHP send the email? If PHP can't send the email, then flash is not your problem. You probably have a problem with your SMTP server in that case.

Also, to echo variables to flash, you need to do this:


$signal=1;
echo "&signal=$signal";


Your also always gonna get an output of 1 because your echoing the "signal", but not from within an if statement, so regardless of whether the mail was sent, it will always output 1.

To output a success or failure of the email being sent, use this:


$Send = mail( "$youremail", "Formula 1", "$content", "From:craig@mydomain.com\n" );
if($Send){
$signal=1;
}else{
$signal=0;
}
echo("&signal=$signal");


You might also look into using LoadVars instead of loadVariablesNum. In my experience LoadVars has been alot more reliable.

Eric :)