Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 6th, 2004, 03:40 PM
kg kg is offline
Registered User
 
Join Date: Nov 2004
Location: , , .
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?
Reply With Quote
  #2 (permalink)  
Old November 6th, 2004, 06:37 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
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
Reply With Quote
  #3 (permalink)  
Old November 7th, 2004, 09:01 AM
kg kg is offline
Registered User
 
Join Date: Nov 2004
Location: , , .
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:09 PM.


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