note 90132 added to function.imap-fetchstructure
| From: | phpnet at totalgood dot com | Date: | Tue, 07 Apr 2009 18:01:18 +0000 |
| Subject: | note 90132 added to function.imap-fetchstructure | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152916@lists.php.net to get a copy of this message | ||
Here's the script I used to test the modified version of David's IMAP email parsing script
(David at Hundsness dot com, message # 85685):
<?
// test_decode_email.php
// by Hobson Lane, http://totalgood.com
// 2009-04-07
include_once ("decode_email.php");
# edit this line if you do not want to use a gmail:
$em = '{imap.gmail.com:993/imap/ssl/novalidate-cert}';
# replace this string with your e-mail account password:
$pw = 'your_password';
# replace thise string with your e-mail account user name:
$un = 'your_name@gmail.com';
$mbox = imap_open($em.'INBOX',$un,$pw)
or die("can't connect: " . imap_last_error());
# get an overview of the mailbox, including the number of messages
$ov = imap_check($mbox);
echo "Fetching e-mail inbox overview, this could take a long time ...";
# probably want to do some client-side processing while you wait for this...
$result = imap_fetch_overview($mbox,"1:{$ov->Nmsgs}",0);
echo( count($result) . " messages to process...<br />\n" );
foreach ($result as $ov) {
echo "<br />\n<br />\n<br />\nNo:{$ov->msgno} ";
echo "ID:{$ov->message_id} UID:{$ov->uid}<br />\n";
echo "From:{$ov->from} Subject:{$ov->subject}<br />\n";
list($htmlmsg, $plainmsg, $charset, $attachments) =
decode_email($mbox, $ov->msgno);
echo "charset:<br />\n$charset<br />\n<br />\n";
echo "htmlmsg:<br />\n$htmlmsg<br />\n<br />\n";
echo "plainmsg:<br />\n$plainmsg<br />\n<br />\n";
foreach($attachments as $fn => $a) {
echo "Found attachment named: $fn:<br />\n";
echo "size: ".strlen($a)."<br />\n<br />\n";
}
} # foreach($result...
imap_close($mbox);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.164.85.171
----
Manual Page -- http://www.php.net/manual/en/function.imap-fetchstructure.php
Edit -- https://master.php.net/note/edit/90132
Del: integrated -- https://master.php.net/note/delete/90132/integrated
Del: useless -- https://master.php.net/note/delete/90132/useless
Del: bad code -- https://master.php.net/note/delete/90132/bad+code
Del: spam -- https://master.php.net/note/delete/90132/spam
Del: non-english -- https://master.php.net/note/delete/90132/non-english
Del: in docs -- https://master.php.net/note/delete/90132/in+docs
Del: other reasons-- https://master.php.net/note/delete/90132
Reject -- https://master.php.net/note/reject/90132
Search -- https://master.php.net/manage/user-notes.php