Voting

: four plus zero?
(Example: nine)

The Note You're Voting On

jbr at ya-right dot com
18 years ago
Musawir Ali comment is not totally correct, ifdisposition= 1 will never tell you 100% if there is an attachment. You must look at (ifdparameters, ifparameters) if (1) of them is greater then (0), then you need to look inside (parameters), looking at each ($obj->parameters) and check the (attribute) for (NAME, FILENAME), also be sure to set them to upper or lower case before doing your testing. That's the only way to know if you have an attachment. inline attachments will have $obj->ifid equal to 1, the $obj->id will contain the (cid). If $obj->ifid equals 0 then it's also an attachment (file type) if you have (NAME, FILENAME) as the current parameters (attribute).

<?php
$name
= '';

if (
$parent->ifdparameters && sizeof ( $parent->dparameters ) > 0 )
{
foreach (
$parent->dparameters as $child )
{
if (
strtolower ( $child->attribute ) == 'name' || strtolower ( $child->attribute ) == 'filename' )
{
$name = strtolower ( $child->value );
}
}
}

if ( empty (
$name ) )
{
if (
$parent->ifparameters && sizeof ( $parent->parameters ) > 0 )
{
foreach (
$parent->parameters as $child )
{
if (
strtolower ( $child->attribute ) == 'name' || strtolower ( $child->attribute ) == 'filename' )
{
$name = strtolower ( $child->value );
}
}
}
}
?>

$parent is derived from imap_fetchstructure(), as a child object if $obj->parts is set or as the $parent if $obj->parts is not set!

<< Back to user notes page

To Top