PDA

View Full Version : made an Email form, but no response :


rinser
05-01-2006, 08:05 PM
Hello
I have made a simple (?) Email form for a little site and have uploaded it here for testing.
I realise that there may be a fault with my Flash form , but i wanted to check here that my email.php for was in order and in the correct folder.

when i try to send an Email right now with this form
http://www.changthai.org/test/netcones9.html

i just see a "transferring data from ... "message and no more activity.


have i made a glaring error in uploading this ? or is it the Flash end ?

thankyou.

sheila
05-01-2006, 10:14 PM
I tried to test your form, and I got no result.

Basically, in order for anyone to offer assistance, we would need to see your code. Although I don't personally have experience with Flash, but hopefully someone else here would be able to offer some tips.

As for the PHP mail form, it is extremely important that even for simple forms, that all data inserted into the form by the site visitor be validated, otherwise if these security precautions are not taken, spammers may be able to exploit your form and send large volumes of spam through the server.

rinser
05-01-2006, 10:24 PM
hi thanks for the reply. I hear what you say about validating the data that is sent - that is next on the list.
as for the code, i have this on the data fields (called from)
onClipEvent(data){

_root.nextFrame();

}
and this on the send button
form.loadVariables("email.php", "POST");

and i have labled each field as name, Email, and Message.

as far as the php, there is this
<?php
$sendTo = "************@hotmail.com";
$subject = "My Flash site reply";


$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);
?>


this was all taken from a tutorial at kirupa
http://www.kirupa.com/developer/actionscript/flash_php_email.htm

if anyone can help, much appreciated !
DJ

sheila
05-02-2006, 01:51 AM
Like I said before...I have no experiences with Flash. But out of curiousity I made a test HTML file and put a copy of your email.php file onto one of my sites and ran it.

Here is my test HTML file:
<html><head><title>Email Test</title></head>
<body>
<form action="email.php" method="POST">
Name:<input type="text" name="name"><br>
Email:<input type="text" name="email"><br>
Message:<textarea>Test. This is the message body.</textarea><br>
</form>
</body>
</html>
Hrrm. I forgot to put in a submit button, but hitting the enter key submitted the form anyhow...

I also modified your php page just a teensy bit...

<?php
$sendTo = "myemail@example.com";
$subject = "My Flash site reply";


$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];

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

echo("Your email has been sent")
?>
Notice the "echo" statement I put in, so that I'd know if the script had actually completed running.

I did get an email sent to me. It had the subject correct but the message body was empty. Also note that you cannot set the Return-path header as you are trying to do. That will be a system address that points to your shell email address, so that errors will be returned to you.

I'm not much of a PHP programmer either, so I'm going to stop there...not sure what you need to do to get the email message into the body of the email...

But at least this type of method lets you test the email.php file separately from the flash file, which I think is important.

Yeah, it is good you will be writing in all of the security features required to validate input, as the script as it currently stands would be wide-open to header stuffing.

rinser
05-02-2006, 06:28 AM
thankyou so much ! will get down to it tonight after work thanks again
DJ

rinser
05-02-2006, 09:12 AM
weird - just saw that i received the Emails sent to this form. one sent early this morning from
sad <******@scooter.futurequest.net> .
i think, therefore, its working, just that i need to adjust my Flash code to notify the user that the info has been sent.