?
Solved

I keep getting a malformed address: error

Posted on 2004-11-29
4
Medium Priority
?
291 Views
Last Modified: 2013-12-12
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.

0
Comment
Question by:phpnovice
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:mureshan
ID: 12703494
What is the mail server that you are using ?

Regards,
Bogdan
0
 
LVL 2

Expert Comment

by:mureshan
ID: 12703547
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
0
 
LVL 9

Accepted Solution

by:
gruntar earned 500 total points
ID: 12703815
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.

Cheers
0
 
LVL 9

Expert Comment

by:gruntar
ID: 12703827
Ups, just correct dot postiton.

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question