# PHP Form Mailer by not2sure

**URL:** https://forum.kirupa.com/t/php-form-mailer-by-not2sure/194786
**Category:** programming
**Created:** [July 26, 2006, 10:20am UTC](https://forum.kirupa.com/t/php-form-mailer-by-not2sure/194786 "2006-07-26T10:20:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![laasmooi](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@laasmooi](https://forum.kirupa.com/u/laasmooi)
#### Post date: [July 26, 2006, 10:20am UTC](https://forum.kirupa.com/t/php-form-mailer-by-not2sure/194786/1 "2006-07-26T10:20:55Z")

</div>

[FONT=Verdana]I implemented mailer.php.  
It seems to work partly.  
When you click on [http://www.paithailand.info/contact\_mailer.php](http://www.paithailand.info/contact_mailer.php), you see a rudimental form.[/FONT][FONT=Verdana][/FONT][FONT=Verdana]Part of the code in that page[/FONT]

```auto

<form action="mailer.php" method="post">
Your Name: <input type="text" name="name"><br>
                    <br>
                    Your Email: <input type="text" name="email"><br>
                    <br>
                    
Your Message:<br> <textarea name="message" rows="5" cols="30"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>

```

When you submit the page the “mailsuccess” page is shown.  
That’s great but I do not get an email!  
My code in mailer.php:

```php
<?PHP 

$to = "postmaster@paithailand.info"; 
$subject = "Results from your Request Info form"; 
$headers = "From: PaiThailand.info"; 
$forward = 1; 
$location = "http://www.paithailand.info/mailsuccess.php"; 

$date = date ("l, F jS, Y"); 
$time = date ("h:i A"); 

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.

"; 

if ($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach ($_POST as $key => $value) { 
        $msg .= ucfirst ($key) ." : ". $value . "
"; 
    }
}
else {
    foreach ($_GET as $key => $value) { 
        $msg .= ucfirst ($key) ." : ". $value . "
"; 
    }
}

mail($to, $subject, $msg, $headers); 
if ($forward == 1) { 
    header ("Location:$location"); 
} 
else { 
    echo "Thank you for submitting our form. We will get back to you as soon as possible."; 
} 

?>

```

[SIZE=4]I think I did exactly what is described on [http://www.kirupa.com/web/form\_mailer.htm](http://www.kirupa.com/web/form_mailer.htm)  
I don’t see what I did wrong.  
Hope you can help me or maybe you know a better script…[/SIZE]
