Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2004, 03:40 PM
kg kg is offline
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mail_IMAP->filename for inline attachments?

Hi,

I hope this is the right place. I'm unable to get the name for the inline attachment (JPG-file). I'm using

$mailbox->msg[$i]['in']['fname'][$x];

where $i is message id and $x part id.

Finding ftype, fsize and cid is no problem. Am I missing something here?

Ideas?
 
Old November 6th, 2004, 06:37 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi,
$x in your example is not the part id, it is the offset count of that particular part. This differs from the part id in that, the part id is a unique string that identifies where the part resides in the MIME message structure, and the offset count is nothing more than the counter, which is used so that one parameter isn't overwritten by another. So distinguishing the difference is important.

As to your question, the filename isn't gauranteed to be set for any message part, neither is the CID. The ftype, (really the MIME type, not aptly named) is always set, and so is the file size. The filename of a part is even more unlikely to be set for inline message parts, since these are part of the message and not attachments. Because they play a different role this parameter isn't always available.

There was a bug in Mail_IMAP::getRelatedParts that was addressed in Mail_IMAP 2 alpha 1 RC 5. If you're still having problems with this, follow the bug submission guidelines posted on my website at http://www.smilingsouls.net.

Given the plethora of different message composers and the potentially limitless possibility for inconsistency it's best to assume as little as possible about what parameters a message will contain. Bugs in Mail_IMAP are another possibility, this can be ruled out by outputting the object returned by imap_fetchstructure with var_dump and checking whether the filename parameter appears there, if it does then it could be a bug in my software, if it does not then the parameter isn't available. A Mail_IMAP_Debug class is included with Mail_IMAP 2 for this very purpose.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old November 7th, 2004, 09:01 AM
kg kg is offline
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you so much for your quick answer! Much more than expected!!

Yes, my problem is the inconsistency you mentioned. But your thoughts made me take a little bit different approach to this, and now everything seems to be working just fine. Thanks!! I really appreciate it.

Kind regards,

Kjell Gaute Grude






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Inline Excel Output Filename Sir Guso ASP.NET 1.0 and 1.1 Professional 2 May 31st, 2007 08:26 PM
Chpt 7 >> Pg 245 >>Try It Out #4-5 harrison4411 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 2nd, 2006 06:26 PM
VB.Net -> Filename -> DTS Package -> tempdB daniel Pro VB.NET 2002/2003 1 October 7th, 2004 01:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.