PHP Mail Form

Hi,

I’m trying to create a form field so the user can submit their email address but it doesn’t seem to return the email address.

I have a file titled “mail.php”


<?php

mail("[email protected]", "Email Subject", $email);

?>

A button with this code attached…
[AS]
on (release) {
loadVariablesNum(“mail.php”, “0”, “POST”);
email.text = “Thank You!”;
}
[/AS]

And a textfield with the instance name “email”

Heres a bunch of threads on the subject of PHP E-mail forms both in and out of Flash…

http://www.kirupaforum.com/forums/search.php?s=&action=showresults&searchid=95094&sortby=lastpost&sortorder=descending

Ive never done a Flash/PHP Form so I won’t be much help, but those threads have your answers.

try this

on (release) {
email = "Thank You!";
loadVariablesNum("mail.php", "0", "POST");
}

yeah, if you are receiving the e-mail, but it doesn’t have any content, then do what ahmed said, and also put this line at the top of your PHP script…


$email = $_POST['email'];

also, make sure that you are giving the input box a variable name, not an instance name. I had a bit of trouble getting my variables to read from the instance name of an input box…

This is what I have now,


<?PHP

$to = "[email protected]";

$msg = "$email

"; 

mail($to, $msg, "For: Mailing List
Reply-To: $email
");

?> 

Everything works except the autoresponder for [email protected] doesn’t get sent to the email address submitted. Is there a way to fix this with the code?

Any Ideas? :bounce:

your syntax is a little wrong… it should be


mail(E-mail, SUBJECT, MESSAGE, HEADERS);

try this… make a file called testMail.php and put this code in it…


<?

$to = "PUT YOUR ADDRESS HERE";
$subject = "Test E-mail";
$message = "This is a test e-mail";

$mail_test = mail($to, $subject, $message);

if($mail_test)
{
     print "Mail sent successfully";
}
else
{
     print "Error sending mail";
}

?>

Just put your e-mail address in where it says. If it still doesn’t work then try this link : http://www.kirupa.com/web/testphp.htm

that will tell you if PHP is set up correctly on your server. If you get the correct screen then scroll down to where it says STMP and make sure it says localhost if not then your host probably has disabled it to prevent Spamming.

**Oh, yeah and you can’t test this locally, it has to be tested on your server (that causes so much trouble…)

Hi, PHP has to be set up correctly on my server because the email data submitted is being sent, it’s just that the email address submitted is not showing up as the “from” addres so the autoresponder doesn
t send a response to the submitted email. Here is my most updated code.


<?PHP

$to = "[email protected]";

$msg = "$email

"; 

$subj = "Mailing List";

mail($to, $subj, $msg, "From: $email
Reply-To: $email
");

?> 

where are you defining the $email variable?

in the flash textfield



<?PHP

$email = $_POST['email'];  

$to = "[email protected]";

$msg = "$email

"; 

$subj = "Mailing List";

$header = "From: $email <$email>
";

$header .= "Reply-To: $email
";

mail($to, $subj, $msg, $header);

?> 


try that… if that doesn’t work then make sure you are using Ahmed’s method of defining the Flash variable…

No go, the email goes through, everything is in check, but no autoresponse is sent. I DON’T GET IT!!! It even has the appropriate mail account. WHAT THE %&$$ IS GOING ON!!! ahhhhhhh

:b:

what do you mean autoresponse?

An autoresponder is an email that is set up to automatically be sent to any address it’s receiving mail from.

ohhh… php doesn’t do that. You have to use the e-mail client for something like that. That is something that you would have to set up in outlook…

and so you know this is incorrect:

“From: $email”

it has to be

“From: $email <$email>”;

that is probably causing the problem. YOu need to have the e-mail address in there twice. Once as the name, and then again in the brackets so that the e-mail program will recognize it as an e-mail address…

code should look like this:


<?PHP

$to = "[email protected]";

$msg = "$email

"; 

$subj = "Mailing List";

$header = "From: $email <$email>
";

$header .= "Reply-To: $email
";

mail($to, $subj, $msg, $header);

?> 

Hi, this is PHP code I am using in conjunction with a flash form and i’m wondering how I can build in a bit of simple email address validation and possibly an autoresponder built into the PHP that gets sent to whatever address is submitted.


<?PHP
$email = $_POST['email'];  
$to = "[email protected]";
$msg = "$email

"; 
$subj = "Mailing List";
$header = "From: $email <$email>
";
$header .= "Reply-To: $email
";
mail($to, $subj, $msg, $header);
?>