View Full Version : php returns mail sent confirmation to Flash
giantdumptruck
01-23-2008, 11:59 AM
I am using a simple php form to send email via a Flash website. Is there any way I can return a message from the php script which confirms the email is sent successfully or unsuccessfully, and this will in turn return text to a dynamic text box in Flash. Please bear in mind I have a grasp on AS2, but none on PHP. Any help welcome.
Flash code:
this.sendEmail_btn.onRelease = function()
{
getURL("mailto:name@address.com", "", "GET");
};
PHP code:
$sendTo = "name@address.com";
$subject = "Website enquiry";
$headers = "From: " . $_POST["clientName"] . "<" . $_POST["clientEmail"] .">\r\n";
$headers .= "Reply-To: " . $_POST["clientEmail"] . "\r\n";
$headers .= "Return-path: " . $_POST["clientEmail"];
$message = $_POST["clientName"] ."\r\n". $_POST["clientEmail"] ."\r\n". $_POST["clientMessage"];
mail($sendTo, $subject, $message, $headers);
CyanBlue
01-23-2008, 01:54 PM
Howdy and Welcome... :)
Please take a look at the PHP scripts in these tutorials...
http://tutorials.flashvacuum.com/index.php?show=Email101
http://tutorials.flashvacuum.com/index.php?show=Email102
ianjcm
01-25-2008, 01:41 AM
I have a question similar to this one. My PHP code works great and I receive the email from my flash form, however it appears like this in my email:
<p align="left"><font face="Arial_11pt_st" size="11" color="#ffffff" letterSpacing="-0.500000" kerning="0">Full Name</font>
<p align="left"><font face="Arial_11pt_st" size="11" color="#ffffff" letterSpacing="-0.500000" kerning="0">Email Address</font>
and so forth.
I am using my gmail account to send these emails to. Is this a problem with Gmail or is there a solution to get rid of all the html and view it with just plain text?
Thanks.
giantdumptruck
01-25-2008, 10:49 AM
Thanks, they were exactly what I was looking for and they work a treat! :D
CyanBlue
01-25-2008, 01:26 PM
Great to hear that it works for you, giantdumptruck... :)
ianjcm... Can you show us your ActionScript you are using???
ianjcm
01-25-2008, 10:41 PM
Sure thing:
Each input text box has a variable assigned to it (name, email, etc) and all of them are held together inside a MovieClip with the instance name "form".
My submit button (separate from the "form" MC) has this action applied to it:
on (release) {
form.loadVariables("email.php","POST");
}
The form MC itself has an action applied to it that goes to the next frame in the timeline that gives the user a message letting them know it was sent successfully:
onClipEvent(data){
_parent.nextFrame();
}
And that's all I have. If i need to post the php too, let me know.
Thanks for the help.
CyanBlue
01-28-2008, 01:20 PM
Use LoadVars() instead of loadVariables() function and assign what you want to send out rather than having Flash send out all the variables inside the form movieClip... I think my link up there should show you the sample codes... Go check it out... ;)
ianjcm
01-29-2008, 01:45 AM
Worked like a charm. Thanks so much.
I didn't realize that I was using your tutorial earlier, before I posted, to get my PHP script to work. Not sure why I didn't set up the Flash using the tutorial as well haha. But thanks again
CyanBlue
01-29-2008, 01:05 PM
Glad to help... :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.