Jump to content

imap_fetchstructure() giving errors, can anyone help?


woolyg

Recommended Posts

Hi all,

 

Here's the code I'm using, after opening an IMAP stream to an inbox. The code previous to this opens the inbox, grabs the emails and iterates through them. This bit is checking an individual mail for attachments.

 

<?php

$structure = imap_fetchstructure($mbox, $email_number);    
$parts = $structure->parts;


$fpos=2;
for($i = 1; $i < count($parts); $i++) 
{
$message["pid"][$i] = ($i);
$part = $parts[$i];

if($part->disposition == 'ATTACHMENT') 
{

	// Save the attachment locally to the server		
	// Find the file extension
	// Save the attachment  to DB code here


	$fpos+=1;
}
}

?>

 

 

 

When I run the script, I get a load of the following reply:

 

Notice: Undefined property: stdClass::$parts in /var/www/html/site/public_html/cron/cron_email_import.php on line XXX

 

 

 

Would this mean that there are no actual attachments in the email being processed?

 

Has anyone ever dealt with this function before?

 

All input appreciated.

WoolyG

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.