I'm retrieving body text of emails from my Gmail Inbox, and I don't want it to fetch the images (for tracking protection). I have kept the settings of Don't display images in Gmail Settings option, but it doesn't work for IMAP. Kindly suggest a way out through PHP etc., if its possible.
<?php
$server = "{imap.gmail.com:993/ssl}INBOX";
$yourEmail = "xyz@gmail.com";
$yourEmailPassword = "abc123";
$mailbox = imap_open($server, $yourEmail, $yourEmailPassword);
$mail = imap_search($mailbox,'SUBJECT "abc"');
$count = count($mail);
echo "<h3>Total number of emails is $count</h3><br>";
rsort($mail);
for ($x = 0; $x < $count; $x++) {
$mail_headers = imap_headerinfo($mailbox, $mail[$x]);
$to = $mail_headers->toaddress;
#$message = quoted_printable_decode(imap_fetchbody($mailbox,$mail[$x],1));
$message = quoted_printable_decode(imap_fetchbody($mailbox,$mail[$x],2));
echo "$message<br>";
}
imap_close($mailbox);
?>