LilyZ Posted September 23, 2007 Posted September 23, 2007 Hi, My name is Lily and I am new to this forum. Since the last post was back in 2004 I decided to start new topic. I have a problem making email form from flash with php to work with your server. PHP code is: <? if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name'])) { $to = "my email"; $subject = stripslashes($HTTP_POST_VARS['sender_subject']); $body = stripslashes($HTTP_POST_VARS['sender_message']); $body .= "\n\n---------------------------\n"; $body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "X-Priority: 1"; if(@mail($to, $subject, $body, $header)) { echo "output=sent"; } else { echo "output=error"; } } else { echo "output=error"; } ?> Please let me know what line should be changed, that your server receive the email form. Thank you so very much. Quote
TCH-Dick Posted September 23, 2007 Posted September 23, 2007 Welcome to the forums Lily. $HTTP_POST_VARS was depreciated sometime ago. You need to either delcare $HTTP_POST_VARS as global or use $_POST as I have below. ><? if(!empty($_POST['sender_mail']) || !empty($_POST['sender_message']) || !empty($_POST['sender_subject']) || !empty($_POST['sender_name'])) { $to = "my email"; $subject = stripslashes($_POST['sender_subject']); $body = stripslashes($_POST['sender_message']); $body .= "\n\n---------------------------\n"; $body .= "Mail sent by: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n"; $header = "From: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n"; $header .= "Reply-To: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "X-Priority: 1"; if(@mail($to, $subject, $body, $header)) { echo "output=sent"; } else { echo "output=error"; } } else { echo "output=error"; } ?> Quote
LilyZ Posted September 23, 2007 Author Posted September 23, 2007 Thank you so much for fast reply! I will try it now in meanwhile please let me know if I need to change anything in send button code. Thank you in advance. Here is how I call the php file from flash: --------------------- on (release) { // Now import the variables we // need to send in this movie clip sender_mail = _root.Semail.text sender_name = _root.Sname.text sender_subject = _root.Ssubject.text sender_message = _root.Smessage.text // all the vars we just imported // will be sent via POST method now loadVariables("sendmail.php",this,"POST"); // and when receives the answer from // the server... this.onData = function() { for(var a in this) trace([a,this[a]]) // ok, next frame _root.nextFrame(); if(this.output=='sent') { // in case of success _root.errTitle = 'Thank You.'; _root.errType = "Your message has been succesfully sent."; } else { // else _root.errTitle = "Error!"; _root.errType = "Attention, an error occurred while processing your message. Please try again later."; } } } ----------------------------------- Quote
LilyZ Posted September 23, 2007 Author Posted September 23, 2007 One more thing: I just check on the server and cgi-bin is set to : mail.php Should I change the name of my php file? What doesn't work is respond from server, to get to "thank you" part . Quote
TCH-Bruce Posted September 23, 2007 Posted September 23, 2007 Welcome to the forums Lily. Sorry I do not know the answer to your question but I am sure one of our better versed php/flash users will be along to offer some help. Quote
LilyZ Posted September 25, 2007 Author Posted September 25, 2007 Thank you all for nice welcome! I still didn't make this to work... I would need help ,please. Thanks. Quote
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.