# Php mail form from flash

**URL:** <https://forum.kirupa.com/t/php-mail-form-from-flash/242721>\
**Category:** Uncategorized\
**Created:** [October 29, 2007, 8:28pm UTC](https://forum.kirupa.com/t/php-mail-form-from-flash/242721 "2007-10-29T20:28:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hroth](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hroth](https://forum.kirupa.com/u/hroth)\
**Post date:** [October 29, 2007, 8:28pm UTC](https://forum.kirupa.com/t/php-mail-form-from-flash/242721/1 "2007-10-29T20:28:29Z")

</div>

Hi there,

I’ve been using this php script for a while and It’s been sweet.  
Lately, I’ve been having trouble with it. Everything seems to work…  
… but it’s not sending the mail… which is a pretty important part. haha

I was wondering if it’s oudated or something.

```php
<?php
// list all vars to be expected from the movie
$vars = array("name", "email", "company", "phone","message_l", "recip");
// and import them into the script
foreach($vars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
else
$$var = '';
// check variables
if(strlen($name) < 2)
die("&content_text.status1=please enter your name&");
if(strlen($message_l) < 2)
die("&content_text.status1=please write a message&");
if(!eregi('^([a-z0-9\._-])+@([^\.]+\.[^\.]+.*)', $email, $matched))
die("&content_text.status1=please enter a correct email address&");
else if(!getmxrr($matched[2], $mxrr))
die("&content_text.status1=your mail server does not seem to exist&");
 
// where to send it
// remove or configure one of the two code blocks
// otherwise your mail will be sent to johnnybegood@hotmail.com :)
 
// *****or one fixed recipient******
$recip = "me@website.com";
// ****end fixed recipient*******
// build up message
// this code for any multiline text fields
$message = str_replace("\r", "
", $message);
// info vars
$sender = $_SERVER[REMOTE_ADDR];
// you can rearrange this - just do not add or remove quotes
$mailbody = "Contact form sent by
Name: $name
Email: $company
Name: $email
Email: $phone
message:
$message_l
-------
sender's ip: $sender";
// send it off
// note - if you omit the last part, a few servers do not send mail at all,
// but most would show strange senders like nobody@server17.hostingcompany.com
mail($recip, "website contact from: $name", $mailbody, "From: $name");
// and tell visitor
print "&content_text.status1=your message has been sent&";
print "&content_text.status1f=ton message a ete envoyer&";
print "&content_text.BasicName=&";
print "&content_text.BasicEmail=&";
print "&content_text.BasicCompany=&";
print "&content_text.BasicPhone=&";
print "&content_text.MessageLong=&";
?>

```
