I keep getting a malformed address: error

I keep getting a malformed address: error

A message that you sent contained one or more recipient addresses that were
incorrectly constructed:

  admin@asite.com <admin@asite.com>: malformed address: <admin@asite.com> may not follow admin@asite.com

This address has been ignored. The other addresses in the message were
syntactically valid and have been passed on for an attempt at delivery.

Here's the code I'm using:


// send email
$myname = $contact_name;
$myemail = $contact_email;

$contactname = $signup[fname];
$contactemail = $signup[email];
$message = "Hello ".$signup[fname].",<BR>".
"Get ready to start getting the hits you deserve.  Now here is your login info:<BR><BR>".
"username: ".$signup[username]."<BR>".
"password: ".$signup[password]."<BR><BR>".
"<B>The next step is to click on this link to activate your account: <a href=".$siteUrl."activate.php?username=".$signup[username].">CLICK HERE</a></b>";
$subject = $title;

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactemail." <".$contactname.">\r\n";
$headers .= "Reply-To: ".$myname." <".$myemail.">\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";

mail($contactemail, $subject, $message, $headers);
$signup[username] = "";


I have just changed to a new server.  
This code worked fine on the my last server with no errors.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What is the mail server that you are using ?

You might try the phpMailer class for sending emails..
I'm using it to send multiple emails on PHP 4.3.9 +Exchange Server 5.0

What about this line..
$headers .= "To: ".$contactemail." <".$contactname.">\r\n";
..should be
$headers .= "To: "..$contactname" <".$contactemail.">\r\n";

You have put contact name in place where contact mail should be.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ups, just correct dot postiton.

$headers .= "To: " . $contactname . " <" . $contactemail . ">\r\n";
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.