Myth of Echelon Posted April 22, 2011 Share Posted April 22, 2011 Okay, so for a college assignment I need to make a website (which is done and dusted). This website contains a questionnaire so that users can anonymously submit feedback regarding the website. Originally, it was pseudo-functional - you could input text, click checkboxes and clear all data to start again but that's it. Variable stores were cleared as soon as the frame was exited. Today, I decided to add coding so that results could actually be emailed to me from within the Flash application - the SWF. Apparently, there is already a .php file hosted at "http://www.actionscript.tv/email.php"'>http://www.actionscript.tv/email.php" (as stated within a Flash lesson file and an official Flash AS3 book I bought). I am currently using this to try and successfully submit a basic email. The coding inside this .php file is: "<?php $sendTo = $_POST["sEmail"]; $subject = $_POST["sSubject"]; $headers = "From: " . $_POST["sName"] . "<" . $_POST["sEmail"] .">\r\n"; $headers .= "Reply-To: " . $_POST["sEmail"] . "\r\n"; $headers .= "Return-path: " . $_POST["sEmail"]; $message = $_POST["sMessage"]; mail($sendTo, $subject, $message, $headers); ?>" and my ActionScript 3 coding is: "import flash.net.URLVariables; import flash.net.URLRequest; import flash.events.Event; var note:String; var now:Date = new Date(); var variables:URLVariables = new URLVariables(); var mailAddress:URLRequest = new URLRequest("http://www.actionscript.tv/email.php"); subButton.addEventListener(MouseEvent.CLICK, emailClick); function emailClick(evt:Event){ if (yes1Count == true && yes2Count == true){ note = "These results have come back from a completed Simply Buy Questionnaire:" + "\n\n" + "The participant heard of us from " + formMov.textBox1.text + "\n" + "The participant found what they were looking for and was satisfied with their user experience" + "\n" + "The participant commented, regarding if there were any aspects they would wish to change: " + formMov.textBox4.text + "\n" + "The participant also added the following comments: " + formMov.textBox5.text + "\n\n" + "These results were submitted on " + now trace(note); } else if (no1Count == true && no2Count == true){ note = "These results have come back from a completed Simply Buy Questionnaire:" + "\n\n" + "The participant heard of us from " + formMov.textBox1.text + "\n" + "The participant did not find what they were looking for and was not satisfied with their user experience" + "\n" + "The participant commented, regarding if there were any aspects they would wish to change: " + formMov.textBox4.text + "\n" + "The participant also added the following comments: " + formMov.textBox5.text + "\n\n" + "These results were submitted on " + now trace(note); } else if (no1Count == true && yes2Count == true){ note = "These results have come back from a completed Simply Buy Questionnaire:" + "\n\n" + "The participant heard of us from " + formMov.textBox1.text + "\n" + "The participant did not find what they were looking for but was satisfied with their user experience" + "\n" + "The participant commented, regarding if there were any aspects they would wish to change: " + formMov.textBox4.text + "\n" + "The participant also added the following comments: " + formMov.textBox5.text + "\n\n" + "These results were submitted on " + now trace(note); } else if (yes1Count == true && no2Count == true){ note = "These results have come back from a completed Simply Buy Questionnaire:" + "\n\n" + "The participant heard of us from " + formMov.textBox1.text + "\n" + "The participant found what they were looking for but was not satisfied with their user experience" + "\n" + "The participant commented, regarding if there were any aspects they would wish to change: " + formMov.textBox4.text + "\n" + "The participant also added the following comments: " + formMov.textBox5.text + "\n\n" + "These results were submitted on " + now trace(note); } variables.sEmail = "myth.of.echelon@live.com"; variables.sMessage = note; variables.sSubject = "Questionnaire Results"; mailAddress.data = variables; mailAddress.method = URLRequestMethod.POST; sendToURL(mailAddress); }" I am not receiving emails when the submit button is clicked. As I am receiving no debug errors when the .swf is compiled and I am receiving feedback from the trace(); functions inside the IF statements, I am inclined to think that the .php is no longer hosted or is incorrectly constructed, for this particular usage. (UPDATE: Upon entering just "www.actionscript.tv" I noticed the website does not exist anymore/never did.) So, to sum up, I need assistance/advice on how to host and use this .php file (as the AS3 is tailored to it) for free to send user results to my email address. Quote Link to comment Share on other sites More sharing options...
Scotteh Posted May 9, 2011 Share Posted May 9, 2011 The reason nobody has helped you yet is because in comparison to most websites, we've only just started and haven't got an expert in this current field as of yet. Quote Link to comment Share on other sites More sharing options...
webdevuser Posted June 10, 2011 Share Posted June 10, 2011 I'm sorry for answering a old topic, but anyway, the solution is quite simple. Change var mailAddress:URLRequest = new URLRequest("http://www.actionscript.tv/email.php"); to var mailAddress:URLRequest = new URLRequest("email.php"); Create a new file in your webserver named : email.php add the following content in it. <?php $sendTo = $_POST["sEmail"]; $subject = $_POST["sSubject"]; $headers = "From: " . $_POST["sName"] . "<" . $_POST["sEmail"] .">\r\n"; $headers .= "Reply-To: " . $_POST["sEmail"] . "\r\n"; $headers .= "Return-path: " . $_POST["sEmail"]; $message = $_POST["sMessage"]; mail($sendTo, $subject, $message, $headers); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.