[PHP] Imap and attachments
Hi, I started using the IMAP functions and ran into a problem with some headers for attachments. The first one is: Content-type: image/psd; x-unix-mode=0644; name=FinalVersion6.psd Content-transfer-encoding: base64 Content-disposition: inline; filename=FinalVersion6.psd Generated by Mac Mail. The filename wont show up in the result of for example imap_fetchstructure. The second is: Content-Type: text/plain Content-Disposition: attachment; filename="Video(019).3gp" Content-Transfer-Encoding: base64 I suspect this one has something to do with the linebreak. It's generated by a modern nokia (7650 I think) I additionaly found a problem calling imap_fetchbody with a non-existent msg number. This will result in a segfault. grt, Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP and Attachments
> How can I check to see if a email has an attachment? Then download it if the > user clicks on it? I've been working on a webmail for POP3 but I guess the idea is about the same. To check if a an email has attachments you use the function imap_fetchstructure() and then you can do something like this: $struc = imap_fetchstructure(); count($struc->parts); if ($no_of_parts > 0) { echo "the message has attachments."; } This is my way of doing it, the 'bad' thing with this kind of code is that it also includes HTML-messages. This can be prevented with some extra code though. For downloading you use the same kind of thing, I guess it slightly more advanced and you have to do some decoding of the message. Best regards, Jome (looking for php-jobs, coding for $15/hour) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] IMAP and Attachments
Hiya all. Doing the usual web based mail system. How can I check to see if a email has an attachment? Then download it if the user clicks on it? Preferably a class, documentation or something similar, if you have it. Please don't link an RFC, I hate RFCs, it is like reading Aramaic upside, backwards and on a webpage with some horribly tiled background and yellow color font. - k -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]