<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>IMAP search crashes</title>
        <description> Hi, Im testing a connection with gmail on easyphp 5.2.10, using a code I got from google, but for some reason whenever i use imap_search, the imap extension crashes, any clues, why is this happening?

/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'theaccount@gmail.com';
$password = 'thepassword';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

/* if emails are returned, cycle through each... */
if($emails) {
	
	/* begin output var */
	$output = '';
	
	/* put the newest emails on top */
	rsort($emails);
	
	/* for every email... */
	foreach($emails as $email_number) {
		
		/* get information specific to this email */
		$overview = imap_fetch_overview($inbox,$email_number,0);
		$message = imap_fetchbody($inbox,$email_number,2);
		
		/* output the email header information */
		$output.= '&amp;lt;div class=&amp;quot;toggler '.($overview[0]-&amp;gt;seen ? 'read' : 'unread').'&amp;quot;&amp;gt;';
		$output.= '&amp;lt;span class=&amp;quot;subject&amp;quot;&amp;gt;'.$overview[0]-&amp;gt;subject.'&amp;lt;/span&amp;gt; ';
		$output.= '&amp;lt;span class=&amp;quot;from&amp;quot;&amp;gt;'.$overview[0]-&amp;gt;from.'&amp;lt;/span&amp;gt;';
		$output.= '&amp;lt;span class=&amp;quot;date&amp;quot;&amp;gt;on '.$overview[0]-&amp;gt;date.'&amp;lt;/span&amp;gt;';
		$output.= '&amp;lt;/div&amp;gt;';
		
		/* output the email body */
		$output.= '&amp;lt;div class=&amp;quot;body&amp;quot;&amp;gt;'.$message.'&amp;lt;/div&amp;gt;';
	}
	
	echo $output;
} 

/* close the connection */
imap_close($inbox);</description>
        <link>http://www.easyphp.org/forums/13/147086/147086/_subject_#msg-147086</link>
        <lastBuildDate>Sat, 11 Feb 2012 03:09:11 +0100</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.easyphp.org/forums/13/147086/147087/_subject_#msg-147087</guid>
            <title>Re: IMAP search crashes</title>
            <link>http://www.easyphp.org/forums/13/147086/147087/_subject_#msg-147087</link>
            <description><![CDATA[ And with EasyPHP 5.3.2i ?]]></description>
            <dc:creator>Amour</dc:creator>
            <category>EasyPHP 5.2.10</category>
            <pubDate>Wed, 14 Jul 2010 05:12:52 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.easyphp.org/forums/13/147086/147086/_subject_#msg-147086</guid>
            <title>IMAP search crashes</title>
            <link>http://www.easyphp.org/forums/13/147086/147086/_subject_#msg-147086</link>
            <description><![CDATA[ Hi, Im testing a connection with gmail on easyphp 5.2.10, using a code I got from google, but for some reason whenever i use imap_search, the imap extension crashes, any clues, why is this happening?<br />
<br />
/* connect to gmail */<br />
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';<br />
$username = 'theaccount@gmail.com';<br />
$password = 'thepassword';<br />
<br />
/* try to connect */<br />
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());<br />
<br />
/* grab emails */<br />
$emails = imap_search($inbox,'ALL');<br />
<br />
/* if emails are returned, cycle through each... */<br />
if($emails) {<br />
	<br />
	/* begin output var */<br />
	$output = '';<br />
	<br />
	/* put the newest emails on top */<br />
	rsort($emails);<br />
	<br />
	/* for every email... */<br />
	foreach($emails as $email_number) {<br />
		<br />
		/* get information specific to this email */<br />
		$overview = imap_fetch_overview($inbox,$email_number,0);<br />
		$message = imap_fetchbody($inbox,$email_number,2);<br />
		<br />
		/* output the email header information */<br />
		$output.= '&lt;div class=&quot;toggler '.($overview[0]-&gt;seen ? 'read' : 'unread').'&quot;&gt;';<br />
		$output.= '&lt;span class=&quot;subject&quot;&gt;'.$overview[0]-&gt;subject.'&lt;/span&gt; ';<br />
		$output.= '&lt;span class=&quot;from&quot;&gt;'.$overview[0]-&gt;from.'&lt;/span&gt;';<br />
		$output.= '&lt;span class=&quot;date&quot;&gt;on '.$overview[0]-&gt;date.'&lt;/span&gt;';<br />
		$output.= '&lt;/div&gt;';<br />
		<br />
		/* output the email body */<br />
		$output.= '&lt;div class=&quot;body&quot;&gt;'.$message.'&lt;/div&gt;';<br />
	}<br />
	<br />
	echo $output;<br />
} <br />
<br />
/* close the connection */<br />
imap_close($inbox);]]></description>
            <dc:creator>namliw</dc:creator>
            <category>EasyPHP 5.2.10</category>
            <pubDate>Wed, 14 Jul 2010 05:01:06 +0200</pubDate>
        </item>
    </channel>
</rss>

