title: I need to stop imap_body from adding line breaks and inserting characters
body: <p>I am retrieving email in XML ADF format from a gmail account. I am using imap_body to retrieve the emails. Looking at the email account, I can see the emails are received in two ways. The first starts like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?adf version="1.0"?&gt;
  
  &lt;adf&gt;
    &lt;prospect status="new"&gt;
      &lt;id sequence="1" source=...
  </code></pre>
  
  <p>The second type starts like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;?adf version="1.0"?&gt;&lt;adf&gt;&lt;prospect status="new"&gt;&lt;id sequence="1" source=...
  </code></pre>
  
  <p>For the second type, imap_body returns are fixed with to 75 characters. The 75th character is inserted as an equality sign (=). Additionally, the characters 3D are added after the normal equality signs producing:</p>
  
  <pre><code>&lt;?xml version=3D"1.0" encoding=3D"UTF-8"?&gt;&lt;?adf version=3D"1.0"?&gt;&lt;adf&gt;&lt;pros=
  pect status=3D"new"&gt;&lt;id sequence=3D"1" source=3D...
  </code></pre>
  
  <p>I can correct the strings using a loop for the 75th character, but if the 74th character is an equality sign, the equality sign and a space is inserted before the non-inserted equality sign instead. </p>
  
  <p>Ex. </p>
  
  <pre><code>&lt;name part=3D"full" type= 
  =3D"business"
  </code></pre>
  
  <p>This throws off the count. I though about compensating for that as well, but would like to try here to fix the actual imap_body request if possible.</p>
  
  <pre><code>//Retrieve emails, make corrections if needed, convert to array
  $inbox = imap_open($cred['host'],$cred['user'],$cred['pass']);
  if(!$inbox){
      $output = ['success' =&gt; false,'error' =&gt; "Unable to connect to host. ".imap_last_error()];
  }else{
      /* Get email list */
      $emails = imap_num_msg($inbox);
      /* Cycle through each email based on count */
      if($emails &gt; 0){
          for($key = 1;$key &lt;= $emails;$key++) {
              /* Retrieve the email body */
              $pull = imap_body($inbox,$key);
              $init = str_replace(["\r","\n"],'',stripslashes($pull));
              //Clears the breaks having the = character and clears the added characters 3D
              if(substr($init,14,2) == "3D" &amp;&amp; substr($init,75,1) == "="){
                  $max = strlen($init);
                  $cnt = 75;//First = character occurance
                  while($cnt &lt; $max){
                      $init = substr($init,0,$cnt).substr($init,$cnt + 1);//remove =
                      $cnt += 75;//Set for next iteration
                  }
                  $init = str_replace("3D",'',$init);//Remove additional 
              }
              $data = simplexml_load_string($init);
              $xml[$key] = json_decode(json_encode($data),true);
          }
      }
  }
  </code></pre>
  
  <p>The second type of email requires the corrections to be made, but will be off due to the double equal/space issue part way throught the email. Due to these issues, simplexml_load_string fails. Again, correcting from imap_body would be ideal or otherwise I will continue making corrections hoping there will not be more types of issues.</p>