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

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.