I would like to display the contents of the body of the email. I tried IMAP in php, but something is VERY wrong. IMAP does not collect the text of my message. He selects ONLY the signature in the body. Therefore, I am looking for alternative methods for reading the contents of the email body on a web page.
here is the original document of my letter:
http://pastebin.com/WQra335P
disclaimer / copyright violation is captured by IMAP, but nothing else is displayed in the body. Does anyone have alternative methods of reading email from gmail or any other site that can display content on a web page?
I refused to let IMAP read it because no one could understand the problem ... I spent hours, so I give up, but here is the code ...
<?php $hostname = '{imap.gmail.com:993/imap/ssl}INBOX'; $username = ' username@gmail.com '; $password = 'password'; $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error()); $emails = imap_search($inbox,'ALL'); if($emails) { $output = ''; rsort($emails); foreach($emails as $email_number) { $overview = imap_fetch_overview($inbox, $email_number, 0); $message = imap_fetchbody($inbox, $email_number, 2); echo $message; echo imap_qprint($message); $message = imap_qprint($message); echo imap_8bit ($message); $DateFormatted = str_replace("-0500", "", $overview[0] -> date); $output .= $overview[0] -> subject ; $output .= $DateFormatted ;
source share