Link to home
Start Free TrialLog in
Avatar of phpnovice
phpnovice

asked on

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.

Avatar of mureshan
mureshan
Flag of Romania image

What is the mail server that you are using ?

Regards,
Bogdan
You might try the phpMailer class for sending emails..
http://phpmailer.sourceforge.net
I'm using it to send multiple emails on PHP 4.3.9 +Exchange Server 5.0

Bogdan
ASKER CERTIFIED SOLUTION
Avatar of gruntar
gruntar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gruntar
gruntar

Ups, just correct dot postiton.

$headers .= "To: " . $contactname . " <" . $contactemail . ">\r\n";