# Contact Form to Email

**URL:** https://forum.kirupa.com/t/contact-form-to-email/332080
**Category:** flash
**Created:** [January 21, 2014, 3:08am UTC](https://forum.kirupa.com/t/contact-form-to-email/332080 "2014-01-21T03:08:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Khadesa](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@Khadesa](https://forum.kirupa.com/u/Khadesa)
#### Post date: [January 21, 2014, 3:08am UTC](https://forum.kirupa.com/t/contact-form-to-email/332080/1 "2014-01-21T03:08:42Z")

</div>

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:

```auto
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
<?php
$to = "a.moses.mosaic@gmail.com";
$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
