Problema headers de función mail

[email protected] ("Gorka")
Newsgroups php.general.es
Message-ID <015901ca74b5$0d5d2070$28176150$@es>
En mi código php llamo a la función mail para mandarme mensajes
automáticamente. Estos mensajes sí que me llegan a nivel interno, pero con
un error de Bad Header. Puede que este error impida que lleguen a nivel
externo, no lo sé. El caso es que me gustaría saber cómo puedo evitar este
error de Bad Header.


Este es el mensaje que aparece en la cabecera del email:

   X-Amavis-Alert: BAD HEADER Improper use of control character (char 0D
hex):
	MIME-Version: 1.0\r\n


Y este es el código php:

   global $attachment_chunk, $attachment_name, $attachment_type,
$attachment_sent, $bcc; 

   $ob = "----=_OuterBoundary_000"; 
   $ib = "----=_InnerBoundery_001"; 
    
   $headers  = "MIME-Version: 1.0\r\n";  
   $headers .= "From: ".$email."\n";  
   $headers .= "To: ".$recipient."\n";  
   $headers .= "Reply-To: ".$email."\n"; 
   $headers .= "Return-Path: Webmaster <[email protected]>\r\n"; 
   if ($bcc) $headers .= "Bcc: ".$bcc."\n";  
   $headers .= "X-Priority: 1\n";  
   $headers .= "X-Mailer: DT Formmail".VERSION."\n";  
   $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n"; 
    
           
   $message  = "This is a multi-part message in MIME format.\n"; 
   $message .= "\n--".$ob."\n"; 
   $message .= "Content-Type:
multipart/alternative;\n\tboundary=\"".$ib."\"\n\n"; 
   $message .= "\n--".$ib."\n"; 
   
   $message .= "Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n"; 
   $message .= "Content-Transfer-Encoding: base64\n\n"; 
   $message .= chunk_split(base64_encode($content))."\n\n"; 
   
   $message .= "\n--".$ib."--\n"; 
   if ($attachment_name && !$attachment_sent) { 
      $message .= "\n--".$ob."\n"; 
      $message .= "Content-Type:
$attachment_type;\n\tname=\"".$attachment_name."\"\n"; 
      $message .= "Content-Transfer-Encoding: base64\n"; 
      $message .= "Content-Disposition:
attachment;\n\tfilename=\"".$attachment_name."\"\n\n"; 
      $message .= $attachment_chunk; 
      $message .= "\n\n"; 
      $attachment_sent = 1; 
   } 
   $message .= "\n--".$ob."--\n"; 
    
   mail($recipient, $subject, $message,
$headers,'[email protected]');


Ya sé que el 'return path' y el 'from' no coinciden, ¿no es obligatorio,
no?.
A ver si me podéis ayudar. Gracias.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.