Search code examples
phpspecial-charactersimap

php imap email body reading


I am getting my email by imap, but stuck up with one email in my inbox which have letter  in it, and imap is not going to get its body. rest of emails going to read fine. Its header is fine, its going to read.

how I can get body of email with this kind of letters

Code sample is here

$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mail server: ' . imap_last_error());
$emails = imap_search($inbox,'SUBJECT "UKPF - New Booking"'); 
$overview = imap_fetch_overview($inbox,$email_number,0);
$message  = imap_fetchbody($inbox,$email_number,2);

Solution

  • I have solved this issue using this quoted printable decode php function. In your case:

    $message = quoted_printable_decode($imap_fetchbody($inbox,$email_number,2));