• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

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

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
designbyknight
Asked:
designbyknight
  • 4
1 Solution
 
Aneesh ChopraCommented:
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
 
designbyknightAuthor Commented:
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
 
designbyknightAuthor Commented:
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
 
designbyknightAuthor Commented:
Does it matter that the submit button is nested inside the form movie ?
0
 
designbyknightAuthor Commented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now