Hi guys

I have this mail function in PHP


function send_email ($recipient, $from, $reply_address, $subject, $message){

ini_set('display_errors', '1');

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'To:$recipient\r\n';
$headers .= 'From:<$from>\r\n';
//$headers .= 'Reply-To:$reply_address\r\n';

if(!mail($recipient, $subject, $message, $headers)){
return 'Mail function failed.';

return 'ok';


Whenever I call it it comes up with the next error:

Warning: mail(): SMTP server response: 501 Syntax error in forward path in E:\apache2triad\htdocs\i2card.co.uk\functions\email_function.php on line 15

From what I can understand, I made a mistake in setting up the header, but I am not sure which one is it.

Could someone point me in the right direction please?