views:

36

answers:

1

Hi everyone,

I have create a script of form processor which is working properly in some servers but now it does not allow to send the mail form the server. If I removes the headers the mail is send

here is the code

$unique_id=md5(uniqid(rand()));
  $this->boundary='-----='.$unique_id;
  $from=($type==1)?((km_str_casecmp("[|re_Email|]",$this->arrkm['FROM']))?$_POST['re_Email']:$this->arrkm['FROM']):$this->arrkm['AUTOFROM'];
  $headers="Date: ".$this->RFCDate().CRLF;
  $headers.="Return-Path: ".$from.CRLF;
  $to=($type==1)?$this->arrkm['TO']:((km_str_casecmp("[|re_Email|]",$this->arrkm['FROM']))?$_POST['re_Email']:$this->arrkm['FROM']);
  $headers.="To: ".$to.CRLF;
  $headers.="From: ".$from.CRLF;
  $replyto=($type==1)?$from:$this->arrkm['AUTOFROM'];
  $headers.="Reply-to: ".$replyto.CRLF;
  if($type==1 && !empty($this->arrkm['CC'])){
   $headers.="Cc: ".$this->arrkm['CC'].CRLF;
  }
  if($type==1 && !empty($this->arrkm['BCC'])){
   $headers.="Bcc: ".$this->arrkm['BCC'].CRLF;
  }
  $subject=($type==1)?$this->arrkm['DATAEMAILSUBJECT']:$this->arrkm['AUTOSUBJECT'];
  $subject=str_replace("\r\n"," ",$subject);
  $subject=str_replace("\r"," ",$subject);
  $subject=str_replace("\n"," ",$subject);
  $subject=$this->replaceTags($subject);
  $headers.="Subject: ".$subject.CRLF;
  $headers.=sprintf("Message-ID: <%s@%s>%s",$unique_id,$this->getServerHostName(),CRLF);
  $headers.="X-Priority: 3".CRLF;
  $headers.="X-Mailer: Kmita Mail (kmitascripts.com) [Version 4]".CRLF;
  // $headers.="Disposition-Notification-To: ".$from.CRLF;
  $headers.="MIME-Version: 1.0".CRLF;
  if(($type==1 && $this->dataemattachment) || ($type==2 && !empty($this->arrkm['AUTOATTACHMENT']) && is_file(stripslashes($this->arrkm['AUTOATTACHMENT'])))){
   $contenttype=2;
  }else{
   $contenttype=($type==1)?$this->arrkm['DATAEMAILFORMAT']:$this->arrkm['AUTOFORMAT'];
  }
  $headers.=$this->getMailMime($contenttype,CRLF);
  $this->from=$from;
  $this->to=$to;
  $this->subject=$subject;
  $this->headers=$headers;

is any problems in creating header for mail?

Please help me, Its very urgent.

A: 

This looks terrible, are you using some third party email library?

Please, use ordinary mail function http://php.net/mail There are also many examples for headers and don't forget fifth parameter of this function

ivan73