Jump to content

BAD_HEADER: Improper use of control character (char 0D hex):


steve m

Recommended Posts

I need help.  I can't seem to figure this out.  I made a form where when submitted, it will email me and two others to notify us that someone is requesting some information.  Well, when somebody tries to submit the form, we get an email from our web host say that the mail was undeliverable - "BAD_HEADER: Improper use of control character (char 0D hex): From: some_email_adress@example.com\r\n".  I can't for the life of me figure out why this is happening.  I've looked at the code and it seems to look all right.  Is there something wrong in the code? 

<?php
$To = preg_replace("/\r/", "", $_POST['email']);
$To = preg_replace("/\n/", "", $_POST['email']);

$headers = "From: $To\r\n";
$headers .= "Reply-To: $To\r\n";
$headers.= "Return-Path: info@rcubed.com\r\n";
$headers .= "CC: $rmail_2, $rmail_3\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";

mail($rmail_1, $Subject, $Message, $headers);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.