# malformed recipient address - PHP



## Damion (Aug 16, 2005)

hi i am woking on making a quiz using PHP for a role play site i belong to. the user inputs there name and there email and then it sends the information to my email. Instead of sending to my email however I get an email in my host email that i host my stuff on saying 



> A message that you sent contained a recipient address that was incorrectly
> constructed:
> 
> From: missing or malformed local part (expected word or "<")
> ...


I have made an email form in the past and it works fine. So i made this exacly the same except i added the quiz information to the send file.

heres the driver:

```
<?php
  $score = 0;
  if ($_POST['question1'] == 'a')
    ++$score;
  if ($_POST['question2'] == 'a')
    ++$score;



  $name = $_REQUEST['Name'];
  $email = $_REQUEST['Email'];
 

   mail( "[email protected]", "Feedback Form Results",
      $name, $score, "From: $email");

?>



YOUR SCORE IS: <? echo $score ?>
```
note i changed the email as to not give mine out.
every thing is spelled the same and the caps are all the same as they are in the HTML document


----------



## Redcore (Aug 14, 2007)

You should use the PHP tags instead of CODE tags in the forum so the syntax is highlighted.

Try combining $name and $score - it's probably interpreting $score as "additional headers" and so on. They have to be in this order in order to function correctly:


```
mail($to, $subject, $message, $additional_headers, $additional_parameters)
```
So try it this way:

```
$message = $name . " scored a " . $score . "/2 in the quiz."; // reads "Bob scored a 2/2 in the quiz."

mail( "[email protected]", "Feedback Form Results", $message, "From: $email");
```
Let me know if that fixes it for you. It should


----------



## Damion (Aug 16, 2005)

yes it works like every other time i try it wich for now is good enouoph. (my processor melted so i just now got to try it) thanks for all the help. I am going to try to stop asking questions i need to learn this stuff on my own, i was just to busy now i am finaly into my web classes so i have time for it


----------



## Redcore (Aug 14, 2007)

Welcome back!

I'm glad you want to learn stuff on your own - but don't worry about asking questions. Sometimes it's just more helpful to have someone explain a concept that nobody seems to answer in a way you understand. I wish I had this kind of forum when I was first starting, I've probably spent more time reverse-engineering PHP code to figure out what each PHP function does than anybody I know just because I didn't have anybody to explain it in HUMAN terms


----------



## Damion (Aug 16, 2005)

lol , thanks and glad to be back. My teacher tried to force me to use dreamweaver monday ewwww.


----------



## Redcore (Aug 14, 2007)

haha...come to the dark side...


----------



## Damion (Aug 16, 2005)

ohhh that remineds me speaking of the dark side. I have a question for you. Don't look in to it or anything this is just to see if it has hapend to you so i know weather i can rule out hostgator as the problem. I have a code for a extremly basic user name and password filed and it worked on the free host i use to use. I moved it over to host gator and i get an error that says method post is not allowd. I thought maybe they din't have short script enabled so i changed all the <? ?> to <?PHP ?> and thats not the problem so im trying to narrow it down, have you ever had simular problems with hostgator?


----------



## Redcore (Aug 14, 2007)

I've never had this problem - I have simple to advanced scripts, and everything in between. If you want to post the code, I can see if I can get it worked out for you.


----------



## Damion (Aug 16, 2005)

maybe in a week or so if i can't figure it out, i wan't to try to fix this one eventualy i will give up if i can't get it but problem solving is a verry inportant part of beeing a programmer . thanks though


----------

