Hey everybody,
Have been stuffing around trying to get this tutorial working,
Everything seems to be working properly however, no emails appear in my inbox,
I think the problem lies in the URL to the php, or perhaps it’s sitting on my server incorrectly…
here’s the code:
submit_btn.addEventListener(MouseEvent.CLICK, sendMessage);
function sendMessage(e:MouseEvent):void
{
var my_vars:URLVariables = new URLVariables();
my_vars.senderName = name_txt.text;
my_vars.senderEmail = email_txt.text;
my_vars.senderMsg = message_txt.text;
var my_url:URLRequest = new URLRequest("mail.php");
my_url.method = URLRequestMethod.POST;
my_url.data = my_vars;
var my_loader:URLLoader = new URLLoader();
my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;
my_loader.load(my_url);
name_txt.text = "";
email_txt.text = "";
message_txt.text = "Message Sent";
}
//
<?php
$to = "[email protected]";
$subject = ($_POST['senderName']);
$message = ($_POST['senderMsg']);
$message .= "
---------------------------
";
$message .= "E-mail Sent From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">
";
$headers = "From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">
";
if(@mail($to, $subject, $message, $headers))
{
echo "answer=ok";
}
else
{
echo "answer=error";
}
?>
Any help or advice is greatly appreciated
Thanks