# E-mail form problems: Mail failure - malformed recipient address



## OllieRP (Sep 17, 2010)

Hi there!

I've just completed a new website for my band and have a contact form on the site. The PHP code is telling any form submissions to go to my E-mail address. The submission codes looks as follows:


```
<?php

$mailTo = "[email protected]";
$mailFrom = $_POST['emailFrom'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = "From:" . $_POST['name'];
            
mail($mailTo, $subject, $message, $mailFrom, $headers);

?>
```
However, when the submit the form the E-mail doesn't get sent to the E-mail address stated in the PHP code but instead it gets chucked on to the server as an error message saying "Mail failure - malformed recipient address". The content of this error E-mail is as follows:

_A message that you sent contained a recipient address that was incorrectly
constructed:

From: missing or malformed local part (expected word or "<")

The message has not been delivered to any recipients._

And then it includes the text and information that was typed in to the contact form. This is really beginning to bug me and starting to cause problems because the website is actually online! Any help would be massivly appreciated.

Many thanks,
Ollie Parker


----------

