Solved

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

Posted on 2008-10-01
5
392 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
  • 4
5 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Does it matter that the submit button is nested inside the form movie ?
0
 

Accepted Solution

by:
designbyknight earned 0 total points
Comment Utility
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

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now