title: mail sending code error in godaddy
body: <p>i have created a mail sending script with one of my word press project and tested it well in my own server , it works and getting all the mail contents including the attachment, later i had transfer the project into godaddy server , 
  error is Array ( [type] => 2 [message] => mail(): Multiple or malformed newlines found in additional_header </p>
  
  <p><code>$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";</code></p>
  
  <p>i need solution in fact am new in php and this is my first post in stack over kindly help me to have a solution </p>
  
  <p>i am attaching the code with this </p>
  
  <pre><code>&lt;?php //Template Name: Page app handle ?&gt;
  &lt;script src="https://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(window).load(function () {
    // Page is fully loaded .. time to fade out your div with a timer ..
     $('#overlay img').fadeOut(5000);
     });
     &lt;/script&gt;
  
  
     &lt;?php 
    if(!isset($_POST['fname']))
    {
  echo "&lt;script&gt;window.location.href = '".   `  `     get_site_url()."/index.php/application/&lt;/script&gt;";
  }
  $ar_modltype = $_POST['model_type'];
  $cntmodel = count($ar_modltype);
  if($cntmodel&gt;0)
  {
  for($j=0;$j&lt;$cntmodel;$j++)
  {
  $modltype = $modltype.", ".$ar_modltype[$j];
  }
   }
  
  $fname = $_POST['fname'];
  $lname = $_POST['lname'];
  $gender = $_POST['gender'];
  $dob = $_POST['dob'];
  $nationality = $_POST['nationality'];
  $mobile = $_POST['mobile'];
  $email = $_POST['email'];
  $location = $_POST['location'];
  $selvissa = $_POST['selvissa'];
  $ethnicity = $_POST['ethnicity'];
  $height = $_POST['height'];
  $hips = $_POST['hips'];
  $hair_color1 = $_POST['hair_color'];
  if($hair_color1=="Other")
  {
  $hair_color=$_POST['s_hair_color'];
  }
  else
  {
   $hair_color=$hair_color1;
   }
  $chest = $_POST['chest'];
  $shoe = $_POST['shoe'];
  $eye_color = $_POST['eye_color'];
  $waist = $_POST['waist'];
  $hair = $_POST['hair'];
  
  /*if (isset($_POST['health_card'])) {
    $healthcard="Yes";
   }
   else
   {
  $healthcard="No";
   }*/
  
  
  if (isset($_POST['driving_license'])) {
   $driving_license="Yes";
  }
  else
  {
      $driving_license="No";
   }
  
  if (isset($_POST['portfolio'])) {
     $portfolio="Yes";
    }
  else
   {
  $portfolio="No";
   }
   /*if (isset($_POST['duty_free'])) {
  $duty_free="Yes";
   }
   else
  {
  $duty_free="No";
   }*/
  
   $ar_availability = $_POST['availability'];
   $cntavail = count($ar_availability);
   if($cntavail&gt;0)
   {
  for($i=0;$i&lt;$cntavail;$i++)
  {
  $availability = $availability.", ".$ar_availability[$i];
  }
   }
  
     $langhid = $_POST['langhid'];
  
  $experience = $_POST['experience'];
  
  //$prvs_events = $_POST['prvs_events'];
  
  $avg_pay = $_POST['avg_pay'];
  
  $remarks = $_POST['remarks'];
  
  
  
     $modltype1 = str_replace(',', '/', $modltype);
  
  //mailing
     $loop = new WP_Query(array('post_type'=&gt;'mainpoint_news','orderby'=&gt;'id','order'=&gt;'asc','posts_per_page' =&gt; 1));
  
      if ($loop-&gt;have_posts()){
  
  
  
  
          $x=1;
  
  
          while($loop-&gt;have_posts()){
          $loop-&gt;the_post();
  
        $meta=  get_post_custom(get_the_ID());   
  
         $strTo= esc_attr($meta['mainpoint_newsarea'][0]);
       // $to="abu"; 
        //echo $to;
         //exit();
  }}
  
  
      $strSubject = substr($modltype1,1).":".$fname;
  
      //$strMessage = $msg;
  
      //*** Uniqid Session ***//
      $strSid = md5(uniqid(time()));
  
      $strHeader = "";
      $strHeader .= "From:".trim($fname)."&lt;".$email."&gt;\nReply-To:".$email."";
  
      $strHeader .= "MIME-Version: 1.0\n";
      $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
      $strHeader .= "This is a multi-part message in MIME format.\n";
  
      $strHeader .= "--".$strSid."\n";
      $strHeader .= "Content-type: text/html; charset=utf-8\n";
      $strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
      $strHeader .= "&lt;h1&gt;Contact Details&lt;/h1&gt;\n";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Categories : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".substr($modltype,1)."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";        
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;First Name : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$fname ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Last Name : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$lname ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Gender : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$gender."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Date of Birth : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$dob ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Nationality : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$nationality ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Mobile  : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$mobile ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Email  :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$email ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Location  :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$location ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Visa Type :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$selvissa ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";        
           $strHeader .= "&lt;h1&gt;Personal Details&lt;/h1&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Ethnicity  : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$ethnicity ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Height  : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$height ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Hips  : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$hips ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Hair Color  :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$hair_color ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Bust/Chest(Inches) :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$chest."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Shoe Size(cm)  : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$shoe ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;"; 
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Eye Color  :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$eye_color  ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
           $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Waist(Inches) :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$waist ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
         $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Hair Type  :   &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$hair ."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
         $strHeader .= "&lt;h1&gt;Additional Information &lt;/h1&gt;";
          //$strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Occupational Health Card :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$healthcard."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
         $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Driving License :  &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$driving_license."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Portfolio : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$portfolio."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Availability : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".substr($availability,1)."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Languages : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".substr($langhid, 1)."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Years of Experience : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$experience."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          //$strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Previous events : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$prvs_events."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Avg Hourly/Daily Rate(In AED) : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$avg_pay."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
         // $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Dubai Duty Free License : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$duty_free."&lt;/b&gt;&lt;/label&gt;&lt;br&gt;";
          $strHeader .= "&lt;label style='font-size:17px'&gt;&lt;b&gt;Remarks : &lt;/b&gt;&lt;/label&gt;&lt;label style='font-size:16px'&gt;&lt;b&gt;".$remarks."&lt;/b&gt;&lt;/label&gt;\n\n";
      //*** Attachment ***//
      for($i=0;$i&lt;count($_FILES["model_photos"]["name"]);$i++)
      {
          if($_FILES["model_photos"]["name"][$i] != "")
          {
              $strFilesName = $_FILES["model_photos"]["name"][$i];
              $strContent = chunk_split(base64_encode(file_get_contents($_FILES["model_photos"]["tmp_name"][$i]))); 
              $strHeader .= "--".$strSid."\n";
              $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; 
              $strHeader .= "Content-Transfer-Encoding: base64\n";
              $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
              $strHeader .= $strContent."\n\n";
          }
      }
  
      for($i=0;$i&lt;count($_FILES["passport"]["name"]);$i++)
      {
          if($_FILES["passport"]["name"][$i] != "")
          {
              $strFilesName = $_FILES["passport"]["name"][$i];
              $strContent = chunk_split(base64_encode(file_get_contents($_FILES["passport"]["tmp_name"][$i]))); 
              $strHeader .= "--".$strSid."\n";
              $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; 
              $strHeader .= "Content-Transfer-Encoding: base64\n";
              $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
              $strHeader .= $strContent."\n\n";
          }
      }
      if($portfolio=="Yes")
      {
      if($_FILES["portfolio_already"]["name"] != "")
          {
              $strFilesName = $_FILES["portfolio_already"]["name"];
              $strContent = chunk_split(base64_encode(file_get_contents($_FILES["portfolio_already"]["tmp_name"]))); 
              $strHeader .= "--".$strSid."\n";
              $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; 
              $strHeader .= "Content-Transfer-Encoding: base64\n";
              $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
              $strHeader .= $strContent."\n\n";
          }
      }
  
      for($i=0;$i&lt;count($_FILES["resume"]["name"]);$i++)
      {
          if($_FILES["resume"]["name"][$i] != "")
          {
              $strFilesName = $_FILES["resume"]["name"][$i];
              $strContent = chunk_split(base64_encode(file_get_contents($_FILES["resume"]["tmp_name"][$i]))); 
              $strHeader .= "--".$strSid."\n";
              $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; 
              $strHeader .= "Content-Transfer-Encoding: base64\n";
              $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
              $strHeader .= $strContent."\n\n";
          }
      }
  
  
      if(trim($fname)!='' &amp;&amp; trim($gender)!='')   
      {
  
      if(@mail($strTo,$strSubject,"null",$strHeader))
      {
  
          echo "&lt;script&gt;window.location.href = '".  get_site_url()."/index.php/application/?suc=1'&lt;/script&gt;";
      }
      else
      {
  
          echo "&lt;script&gt;window.location.href = '".  get_site_url()."/index.php/application/?suc=0'&lt;/script&gt;";
          print_r(error_get_last()); 
      }
      }
      else
      {
          echo "&lt;script&gt;window.location.href = '".  get_site_url()."/index.php/application/?suc=0'&lt;/script&gt;";
          print_r(error_get_last()); 
      }
  
  
  ?&gt;
  </code></pre>
  
  <p>returning error is Array ( [type] => 2 [message] => mail(): Multiple or malformed newlines found in additional_header </p>
  
  <p>this code works perfectly in my server , but it doesn't work on godaddy server , my question is what to do make this code works in godaddy server</p>