Pufas Posted April 24, 2011 Share Posted April 24, 2011 Hello, Here's little script that should get all email's subject via IMAP: <?php $imap = imap_open("{imap.gmail.com:993/imap/ssl}", "[email protected]", "password"); $message_count = imap_num_msg($imap); for ($i = 1; $i <= $message_count; ++$i) { $header = imap_fetchheader($imap,$i,0); $first=strstr($header, "Subject: "); $second=strstr($header, "From: "); $fc=strlen($first); $sc=strlen($second); $le=$fc-$sc-9; $subject=substr($first,8,$le); echo $subject."\n"; } imap_close($imap); ?> Well it works just fine on inbox with few emails, else, if you have lots of mail with attachments, it will give 30 sec timeout warning. How the the would i bypass downloading the whole message+body, but just a header (subject). Thank's in advance! Link to comment https://forums.phpfreaks.com/topic/234607-geting-subjects-with-imap/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.