TINY_MID Posted November 19, 2006 Share Posted November 19, 2006 Hey people, hopefully someone on here will be able to help me, this problem is probably very simple, but I'm a bit new to this and this has me completely stumped!!Ok I have created a flash site, and I wanted to incorporate a form on the site where user's can comment/email to me. So I have created the form etc, but now I can't get it to actually send an email to me.I have looked on my hosting companies site and came accross this:"[i]When the form is submitted to sendmail.php, the contents of the email field in the form are inserted into a PHP variable called $email, and the contents of the message field are inserted into the variable $message. The script calls a special function called mail, which takes care of the actual dispatch. The first parameter to mail is the address to which you want the form contents sent, in this case your own email address. The second parameter is the subject of the email message, the third is the content of the message, and the fourth is the "From" header so that you know who the sender is, and can reply.In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP (Simple Mail Transfer Protocol), and all StreamlineNet SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by StreamlineNet. The final part of the script thanks the visitor for the message. This is done by sending an HTTP header back to the visitor's browser telling it to load a file called thankyou.html from your domain. The /header/function allows you to send any HTTP header back to the browser.Note: The script has to be enclosed within the “” tags because the PHP processor treats all input as HTML code unless otherwise specified. On some systems, you may need to use “” as the opening and closing tags to get the script to work[/i]."And the .php script they provide is:"[code]<?phpmail("[email protected]", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);header( "Location: http://www.yourdomain.co.uk/thankyou.html" );?>[/code]"But I dont know what to change so when I click on submit it sends an email to me.On my flash site on the contacts page, I have created I have this code:[code]stop();fullName_txt.tabIndex = 1;email_txt.tabIndex = 2;comments_txt.tabIndex = 3;submit_btn.onRelease = function() {var my_lv:LoadVars = new LoadVars();my_lv.fullName = fullName_txt.text;my_lv.email = email_txt.text;my_lv.comments = comments_txt.text;if (fullName_txt.text != "" && email_txt.text != "" && comments_txt.text != ""){my_lv.send("sendmail.php","_blank", "POST");gotoAndStop("success");}else{gotoAndStop("error");}}[/code]Does that look right, or do I need to change something there? hopefully I've put this in the right part of the site, so if anyone can shed any light I'd be very grateful, this is the first site I've come accross that actually looks decent, so hopefully someone can help.Thanks, and I eagerly await your reply.TINYp.s my site is www.invisibleman-mcfc.co.uk and email is [email protected] Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/ Share on other sites More sharing options...
doni49 Posted November 19, 2006 Share Posted November 19, 2006 I see a few things to comment on.[list][*]In the 1st code segment, the email address is hard coded. You DID change the email address-right?[*]The second code segment is NOT PHP code. It's FLASH.[/list] Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/#findComment-127054 Share on other sites More sharing options...
TINY_MID Posted November 19, 2006 Author Share Posted November 19, 2006 Lol. Yeah I did change the address...but nothing. This is really starting to do my head in now.Yeah the second lot of 'code' is from my flash file, the action script. if you see where it says... [code]my_lv.send("sendmail.php","_blank", "POST");[/code]Am i writing that right, for it to point to sendmail.php and then send it? The php code I use, is [code]<?phpmail("[email protected]", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);header( "Location: http://www.invisibleman-mcfc.co.uk/thanks.html" );?>[/code]But in that help file it states that "In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP (Simple Mail Transfer Protocol), and all StreamlineNet SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by StreamlineNet" And that is what i completely baffling me. Any ideas what this means, or how I can finally get this damn thing to work? lol cheers in advance. Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/#findComment-127057 Share on other sites More sharing options...
doni49 Posted November 19, 2006 Share Posted November 19, 2006 Try putting the following in an html file. just to confirm that it works. Then you'll know that it's a problem with your flash code.But personally, I wouldn't use the code they've posted. It does NO error checking. Do you have the rights to put up your own PHP scripts?[code]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <Title> Contact Me </title></HEAD><BODY><form action="/sendmail.php" method="get"> <br /><b>Email Address*:</b> </td><td><input type="text" name="email" size="50" maxlength="40" value="" > <br /><b>Comments:</b></td><td><TEXTAREA name="message" VALUE="" ROWS=10 COLS=40></TEXTAREA>> <br /><input type="submit" name="submit" value="Submit"> <input type="submit" name="reset" value="Start Over" /></div></form></BODY></HTML>[/code] Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/#findComment-127062 Share on other sites More sharing options...
TINY_MID Posted November 20, 2006 Author Share Posted November 20, 2006 Hi thanks for the reply.When I use your HTML code for that simple form, it works...which means I'm doing something wrong in flash? I think I am allowed to use my own php scripts yes, why? Also, do you know anything about flash and can you spot maybe what Im doing wrong? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/#findComment-127264 Share on other sites More sharing options...
doni49 Posted November 20, 2006 Share Posted November 20, 2006 [quote author=TINY_MID link=topic=115543.msg470719#msg470719 date=1163982229]When I use your HTML code for that simple form, it works...which means I'm doing something wrong in flash?[/quote]PROBABLY But I don't know ANYTHING about flash so I can't even begin to guess.[quote author=TINY_MID link=topic=115543.msg470719#msg470719 date=1163982229]I think I am allowed to use my own php scripts yes, why? [/quote]Well as I said in my previous message, I wouldn't be using that PHP code--it does NO error checking. I would check to make sure the user actually entered a message AND make sure they didn't enter something that shouldn't be entered. If you don't "clean" it, there are ways that an unscrupulous user could use your form to send spam USING YOUR SERVER.[quote author=TINY_MID link=topic=115543.msg470719#msg470719 date=1163982229]Also, do you know anything about flash and can you spot maybe what Im doing wrong? Thanks in advance.[/quote]As I said above, I know NOTHING about Flash. This is a forum for PHP help. You'll likely get better help on a forum where they regularly discuss Flash.Here are some places to try posting flash questions:http://www.phpfreaks.com/forums/index.php/board,45.0.html - This is one of the forums here on this site. But it's not specifically for flash. It's just for "other languages" (other than PHP or AJAX).http://www.codingforums.com/forumdisplay.php?f=32 - They seem to discuss flash a little more than I've seen here. Link to comment https://forums.phpfreaks.com/topic/27769-form-to-mail-script/#findComment-127273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.