kutchbhi Posted October 24, 2013 Share Posted October 24, 2013 $mail_headers = imap_headerinfo($inbox, $emails[0]); $head = imap_fetchheader($inbox, $mail_headers->Msgno, FT_INTERNAL & FT_PREFETCHTEXT ); $mail_body = imap_fetchbody($inbox, $mail_headers->Msgno, '1', FT_INTERNAL); // file_put_contents('spotify.csv', $mail_body) ; print_r($mail_body) ; I am trying to read a message from a pop3 email account. the email which contains a csv file as text, When I try to print_r the email_body it contains more new lines than what it had originally. My guess is that the imap_fetch functions are inserting newlines inside the text (to make it readable). How do I prevent this ? Quote Link to comment Share on other sites More sharing options...
iarp Posted October 24, 2013 Share Posted October 24, 2013 Have you tried adding FT_INTERNAL to the imap_fetchbody $options. string imap_fetchbody ( resource $imap_stream , int $msg_number , string $section [, int $options = 0 ] ) FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF. Not 100% sure that'll do what you want, as I've never personally worked with this function before, but reading that it looks like by default it changes it to CRLF. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.