Odd Php Contact Form Problem

I used a tutorial from this site ***http://www.developphp.com***, that helped me create a contact form, for my site.

It all works fine, sending email, messages etc, except that it seems to be sending the content of the email, the actual body text as an attachment, because when I check my email on the site their is no body text that is displayed, just an attachment. I’m at a lost to figure out why and the forum closed down at the site that I followed the tutorial from.

Is there anything in the AS3 code below, or the php code that indicates why this could be the case. Am I miss something obvious?

AS3 code:


 
[SIZE=2]// Set text formatting colors for errors, waiting..., and success mechanisms[/SIZE]
[SIZE=2]var errorsFormat:TextFormat = new TextFormat();[/SIZE]
[SIZE=2]errorsFormat.color = 0xFF0000;[/SIZE]
[SIZE=2]var waitingFormat:TextFormat = new TextFormat();[/SIZE]
[SIZE=2]waitingFormat.color = 0x339900;[/SIZE]
[SIZE=2]var successFormat:TextFormat = new TextFormat();[/SIZE]
[SIZE=2]successFormat.color = 0x3366FF;[/SIZE]
[SIZE=2]// hide the little processing movieclip[/SIZE]
[SIZE=2]processing_mc.visible = false;[/SIZE]
[SIZE=2]// Assign a variable name for our URLVariables object[/SIZE]
[SIZE=2]var variables:URLVariables = new URLVariables();[/SIZE]
[SIZE=2]// Build the varSend variable[/SIZE]
[SIZE=2]var varSend:URLRequest = new URLRequest("http://www.mountcalvarybaptistchurchspringfield.org/prayer_parse.php");[/SIZE]
[SIZE=2]varSend.method = URLRequestMethod.POST;[/SIZE]
[SIZE=2]varSend.data = variables;[/SIZE]
[SIZE=2]// Build the varLoader variable[/SIZE]
[SIZE=2]var varLoader:URLLoader = new URLLoader;[/SIZE]
[SIZE=2]varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;[/SIZE]
[SIZE=2]varLoader.addEventListener(Event.COMPLETE, completeHandler);[/SIZE]
[SIZE=2] [/SIZE]
[SIZE=2]// Handler for PHP script completion and return[/SIZE]
[SIZE=2]function completeHandler(event:Event):void{[/SIZE]
[SIZE=2]// remove processing movieclip[/SIZE]
[SIZE=2]processing_mc.visible = false;[/SIZE]
[SIZE=2]// Clear the form fields[/SIZE]
[SIZE=2]name_txt.text = "";[/SIZE]
[SIZE=2]email_txt.text = "";[/SIZE]
[SIZE=2]msg_txt.text = "";[/SIZE]
[SIZE=2]// Load the response from the PHP file[/SIZE]
[SIZE=2]status_txt.text = event.target.data.return_msg;[/SIZE]
[SIZE=2]status_txt.setTextFormat(successFormat);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]// Add an event listener for the submit button and what function to run[/SIZE]
[SIZE=2]submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);[/SIZE]
[SIZE=2]// Validate form fields and send the variables when submit button is clicked[/SIZE]
[SIZE=2]function ValidateAndSend(event:MouseEvent):void{[/SIZE]
 
[SIZE=2]//validate form fields[/SIZE]
[SIZE=2]if(!name_txt.length) { [/SIZE]
[SIZE=2]status_txt.text = "Please enter your name."; [/SIZE]
[SIZE=2]status_txt.setTextFormat(errorsFormat);[/SIZE]
[SIZE=2]} else if(!email_txt.length) {[/SIZE]
[SIZE=2]status_txt.text = "Please enter an email address";[/SIZE]
[SIZE=2]status_txt.setTextFormat(errorsFormat);[/SIZE]
[SIZE=2]} else if(!validateEmail(email_txt.text)) {[/SIZE]
[SIZE=2]status_txt.text = "Please enter a VALID email address";[/SIZE]
[SIZE=2]status_txt.setTextFormat(errorsFormat);[/SIZE]
[SIZE=2]} else if(!msg_txt.length) {[/SIZE]
[SIZE=2]status_txt.text = "Please enter a message.";[/SIZE]
[SIZE=2]status_txt.setTextFormat(errorsFormat);[/SIZE]
[SIZE=2]} else {[/SIZE]
 
[SIZE=2]// All is good so send the message to the parse file[/SIZE]
[SIZE=2]// Show the little "processing_mc" movieclip[/SIZE]
[SIZE=2]processing_mc.visible = true;[/SIZE]
 
[SIZE=2]// Ready the variables for sending[/SIZE]
[SIZE=2]variables.userName = name_txt.text;[/SIZE]
[SIZE=2]variables.userEmail = email_txt.text;[/SIZE]
[SIZE=2]variables.userMsg = msg_txt.text; [/SIZE]
[SIZE=2]// Send the data to the php file[/SIZE]
[SIZE=2]varLoader.load(varSend);[/SIZE]
 
[SIZE=2]// Put a temporary message in the response field while the PHP file sends back[/SIZE]
[SIZE=2]// If the code does not connect to the PHP file this message will remain visible to user[/SIZE]
[SIZE=2]status_txt.text = "Waiting for server connection...";[/SIZE]
[SIZE=2]status_txt.setTextFormat(waitingFormat);[/SIZE]
[SIZE=2]} // close else after form validation[/SIZE]
[SIZE=2]} // Close ValidateAndSend function //////////////////////////////////////////////////////////////[/SIZE]
[SIZE=2] [/SIZE]
[SIZE=2]// Validate email function[/SIZE]
[SIZE=2]function validateEmail(str:String):Boolean {[/SIZE]
[SIZE=2]var pattern:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;[/SIZE]
[SIZE=2]var result:Object = pattern.exec(str);[/SIZE]
[SIZE=2]if(result == null) {[/SIZE]
[SIZE=2]return false;[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]return true;[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]////////////////////////////////////[/SIZE]
 

PHP script:


[SIZE=2]<? [/SIZE]
[SIZE=2]/*[/SIZE]
[SIZE=2]--- Created by Adam Khoury @ www.developphp.com ---[/SIZE]
[SIZE=2]*/[/SIZE]
[SIZE=2]// Create local variables from the Flash ActionScript posted variables[/SIZE]
[SIZE=2]$senderName = $_POST['userName'];[/SIZE]
[SIZE=2]$senderEmail = $_POST['userEmail'];[/SIZE]
[SIZE=2]$senderMessage = $_POST['userMsg'];[/SIZE]
[SIZE=2]// Strip slashes on the Local variables for security[/SIZE]
[SIZE=2]$senderName = stripslashes($senderName);[/SIZE]
[SIZE=2]$senderEmail = stripslashes($senderEmail);[/SIZE]
[SIZE=2]$senderMessage = stripslashes($senderMessage); [/SIZE]
[SIZE=2]// IMPORTANT - Change these lines to be appropriate for your needs - IMPORTANT[/SIZE]
[SIZE=2]$to = "prayer@mountcalvarybaptistchurchspringfield.org"; [/SIZE]
[SIZE=2]$from = "$senderEmail";[/SIZE]
[SIZE=2]$subject = "Prayer Request from the site";[/SIZE]
[SIZE=2]// Modify the Body of the message however you like[/SIZE]
[SIZE=2]$message = "Message from your website:[/SIZE]
[SIZE=2]Their Name: $senderName [/SIZE]
[SIZE=2]Their Email: $senderEmail[/SIZE]
[SIZE=2]Their Message is below: [/SIZE]
[SIZE=2]$senderMessage";[/SIZE]
[SIZE=2]// Build $headers Variable[/SIZE]
[SIZE=2]$headers = "From: $from
";[/SIZE]
[SIZE=2]$headers .= "Content-type: text
"; [/SIZE]
[SIZE=2]$to = "$to";[/SIZE]
[SIZE=2]// Send the email[/SIZE]
[SIZE=2]mail($to, $subject, $message, $headers);[/SIZE]
 
[SIZE=2]// Assemble the message that goes back to Flash[/SIZE]
[SIZE=2]// The flash ActionScript is looking for a return variable of "return_msg"[/SIZE]
[SIZE=2]$my_msg = "Thanks $senderName, your message has been sent.";[/SIZE]
[SIZE=2]// Print the data back to flash who is patiently waiting for it in the onCompleteHandler[/SIZE]
[SIZE=2]print "return_msg=$my_msg"; [/SIZE]
[SIZE=2]// Exit script [/SIZE]
[SIZE=2]exit();[/SIZE]
[SIZE=2]?>[/SIZE]