note 83533 deleted from function.imap-body by nlopess
| From: | nlopess@php.net | Date: | Sun, 01 Jun 2008 16:01:16 +0000 |
| Subject: | note 83533 deleted from function.imap-body by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140045@lists.php.net to get a copy of this message | ||
Note Submitter: levon at domainisinthecomment dot co dot uk
----
The code below will read all the messages in a box/folder. See the imap_sort function page for more
info on sorting the messages. In the example I am using my domain http://altjira.co.uk. Just replace this and add in your user and
pass.
<?php
$host = '{mail.altjira.co.uk/notls/imap4}INBOX';
$user = 'me+altjira.co.uk';
$pass = 'mypass';
$imap = imap_open( $host, $user, $pass );
$msgs = imap_sort( $imap, SORTARRIVAL, 1 );
foreach( $msgs as $msg ) {
$msg_body = imap_body( $imap, $msg );
echo $msg_body . "\n\n";
}
imap_close( $imap );
?>