Solved

I keep getting undefined emails when i try to send my flash email form

Posted on 2008-10-01
5
401 Views
Last Modified: 2013-12-17
Hiya all
  I'll start from the beggining then.
i have a website of the flash variety and inside the mian movvie i have got, nested, a form with which i want people to be able to email me information. The form is an example i downloaded off the web. Before i published my site to the server i uploaded this form.swf file and the related php file. I then visited the url, and filled ou the form and clicked send.... no problem and the form worked a treat ( i recieved the email). i then opened up my main.swf and scrolled across the timeline to the page in which i wanted to put this form.  I then created a new movie clipand copy and pasted the forms frames and action script into it. I then put this movie clip into the page where i wanted it. i then uploaded the main website onto my server along with the php file and now it doesn't work.   Phplease help !!!!  Here's the send button actionscript:-
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.";
            }
      }
}

.... and here is the php code:-

<?
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 = "superdaveyk@hotmail.co.uk";
      $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 help if you can....... things are getting pretty desperate now :-(
0
Comment
Question by:designbyknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 22617298
just replace following code:
//-------------------------------------
 sender_mail = _root.Semail.text
 sender_name = _root.Sname.text
 sender_subject = _root.Ssubject.text
 sender_message = _root.Smessage.text
//----------------------------------------------

replace above code with following:
//-------------------------------------
 sender_mail = this.Semail.text
 sender_name = this.Sname.text
 sender_subject = this.Ssubject.text
 sender_message = this.Smessage.text
//----------------------------------------------
0
 

Author Comment

by:designbyknight
ID: 22617672
Thanks for the rapid reply .. .... i tried this code change and now i don't get any emails at all !!!
     so i guess it's something to do with the script somewhere ... i thought it might have something to do with where the files are located on the remote server ???
0
 

Author Comment

by:designbyknight
ID: 22617753
My humblest apologies .... lack of sleep is making me halucinate

    the emails took a while to get there but they are still coming through as undefined ...even with this code change
  thanks in advance for your patience
0
 

Author Comment

by:designbyknight
ID: 22618162
Does it matter that the submit button is nested inside the form movie ?
0
 

Accepted Solution

by:
designbyknight earned 0 total points
ID: 22619404
okay new development
 i have now inserted another form...... this one appears to work except ...

it says the message was succesfully sent however i'm not actually receiving the email in my inbox
this is the new php script. could anyone tell where i'm going wrong as i really dont want another night without sleep.  code is as follows:-

<?

Error_Reporting(E_ALL & ~E_NOTICE);
$subject="from ".$_REQUEST['Your_Name:'] ;
$headers= "From: ".$_REQUEST['Your_Email:'] ."\n";
 $headers.='Content-type: text/html; charset=iso-8859-1';
 $message='';
  while ($field = current($_REQUEST)) {
        if ((key($_REQUEST)!="Your_Name:") && (key($_REQUEST)!="Your_Email:") && (key($_REQUEST)!="Message:") && (key($_REQUEST)!="i")) {
             $message.="<strong>".key($_REQUEST)."</strong>&nbsp;&nbsp;&nbsp;".$field."<br>";
      }
      next($_REQUEST);
 }
$message.="<br>".$_REQUEST['Message:'];
mail($_REQUEST['superdaveyk@hotmail.co.uk'], $subject,  "
<html>
<head>
 <title>Contact letter</title>
</head>
<body>
<br>
  ".$message."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");

?>
<script>
      resizeTo(300, 300);

</script>
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question