Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
pleae help me how to solve this error.

Warning: mail() [function.mail]: SMTP server response: 503 Bad sequence of commands




$to = $email;
$from="------@gmail.com";
$subject = "Payment Info";
$message = '
<html>
<head>
<title>Payment info</title>
</head>
<body>

Here is your payment information





Name :'.$name. '
Amount :'.$amount. '

</body>
</html>
';

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To:'.$to. "\r\n";
$headers .= 'From:'. $from . "\r\n";



mail($to, $subject, $message, $headers);
Posted

1 solution

I can see only one problem right now but I don't think it's a reason for this error message: you use $to twice: in headers and first parameter in mail. You should not add it to headers as it is passes as a parameter anyway, the function call will do it.

I don't know exactly what to reason of the error. Are you sure the mail is properly set up in your Web server's host? This is one of "relay" problems.
Please see this discussion:
http://www.kirupa.com/forum/showthread.php?95806-503-Bad-sequence-of-commands-!-![^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900