note 73426 added to function.imap-fetchbody
| From: | anonymous at coward dot village | Date: | Thu, 22 Feb 2007 19:08:29 +0000 |
| Subject: | note 73426 added to function.imap-fetchbody | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123722@lists.php.net to get a copy of this message | ||
A very easy way to handle attachments is just using munpack, with a subdirectory called attachments
chmod it to 777 and then use the following bit of code (with mpack installed) on the MIME encoded
body:
<?php
//email MIME body in $input
file_put_contents("attachments/body.eml",$input);
$command = "munpack -C attachments -fq body.eml";
exec($command,$output);
if($output[0]!='Did not find anything to unpack from body.eml') {
foreach ($output as $attach) {
$pieces = explode(" ", $attach);
$part = $pieces[0];
echo "<a href=\"attachments/$part\">$part</a><br>";
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.134.17.246
----
Manual Page -- http://www.php.net/manual/en/function.imap-fetchbody.php
Edit -- https://master.php.net/note/edit/73426
Del: integrated -- https://master.php.net/note/delete/73426/integrated
Del: useless -- https://master.php.net/note/delete/73426/useless
Del: bad code -- https://master.php.net/note/delete/73426/bad+code
Del: spam -- https://master.php.net/note/delete/73426/spam
Del: non-english -- https://master.php.net/note/delete/73426/non-english
Del: in docs -- https://master.php.net/note/delete/73426/in+docs
Del: other reasons-- https://master.php.net/note/delete/73426
Reject -- https://master.php.net/note/reject/73426
Search -- https://master.php.net/manage/user-notes.php