I have some simple php code. It worked fine on the old server, but now I am getting an error on the new server. Both former and present servers are Linux.
<?php
function ConfirmationEmail ()
{
$from = "mo@abc.com";
$recipient = "bill@yahoo.com";
$cc1 = $from;
$cc2 = "mo@gmail.com";
$subject = "Trial e-mail!";
$message = "This is a test!\n";
$headers = "From: " . $from . "\r\n" . "Cc: " . $cc1 . " " . $cc2;
$success = mail($recipient,$subject,$message,$headers);
if ($success)
echo "<br>A confirmation e-mail was just sent to you.<br>";
else
{
echo "An attempt was made to send you an e-mail, ";
echo "but it was unsuccessful. <br>";
}
}
?>
Here is my error message that I get from the mail server in an e-mail. Subject line is
"Inbox: Mail failure - malformed recipient address"
A message that you sent contained one or more recipient addresses that were
incorrectly constructed:mo@abc.com mo@gmail.com: malformed address: mo@gmail.com may not follow mo@abc.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.
The e-mail addresses have been changed. The second address of the cc line is getting tossed out (mo@gmail.com). I'm not sure why. The recipient and the first cc address are being sent correctly. It worked on the last server. Any ideas? Thanks.