Re: [PHP] Re: PHP IMAP with Attachments!?

2007-01-24 Thread Angelo Zanetti



Manuel Lemos wrote:


Hello,

on 10/31/2006 01:36 PM Andy said the following:
 


I need a class that reads emails from a server and reads the
   


attachments from the mail.
 


The mailservers is an IMAP for mail reading.

The attachment types can be: images/pdf/text documents.

Any suggestions?

On phpclasses.org did not find any which works well.
   



I think the PHP IMAP extension can do all you need, if you have it
installed. Otherwise, you can just use pure PHP IMAP client class and
the use this MIME message parser to extract the message body parts into
a string or a separate file:

http://www.phpclasses.org/mimeparser

This gets the messages without using the PHP IMAP extension:

http://www.phpclasses.org/imap


 

Im facing a simliar problem  Im using the mimeparser and the pop3class 
and can see the attachment name but im not sure how to access it and 
save it to a directory of my choice. So far I see the results of the 
array generated after the message has been coded but still not sure how 
to access the attachement. The output is as follows:


Array ( [Headers] = Array ( [return-path:] = [to:] = Manuel Lemos 
[subject:] = Testing Manuel Lemos' MIME E-mail composing and sending 
PHP class: HTML message [from:] = mlemos [reply-to:] = mlemos 
[sender:] = [EMAIL PROTECTED] [x-mailer:] = 
http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail) 
[mime-version:] = 1.0 [content-type:] = multipart/mixed; 
boundary=652b8c4dcb00cdcdda1e16af36781caf [message-id:] = 
[EMAIL PROTECTED] [date:] = Sat, 30 Apr 2005 
19:28:29 -0300 ) [Parts] = Array ( [0] = Array ( [Headers] = Array ( 
[content-type:] = multipart/related; 
boundary=6a82fb459dcaacd40ab3404529e808dc ) [Parts] = Array ( [0] = 
Array ( [Headers] = Array ( [content-type:] = multipart/alternative; 
boundary=69c1683a3ee16ef7cf16edd700694a2f ) [Parts] = Array ( [0] = 
Array ( [Headers] = Array ( [content-type:] = text/plain; 
charset=ISO-8859-1 [content-transfer-encoding:] = quoted-printable ) 
[Parts] = Array ( ) [BodyPart] = 1 [BodyLength] = 91 ) [1] = Array ( 
[Headers] = Array ( [content-type:] = text/html; charset=ISO-8859-1 
[content-transfer-encoding:] = quoted-printable ) [Parts] = Array ( ) 
[BodyPart] = 2 [BodyLength] = 961 ) ) ) [1] = Array ( [Headers] = 
Array ( [content-type:] = image/gif; name=logo.gif 
[content-transfer-encoding:] = base64 [content-disposition:] = inline; 
filename=logo.gif [content-id:] = ) [Parts] = Array ( ) [BodyPart] 
= 3 [BodyLength] = 1195 ) [2] = Array ( [Headers] = Array ( 
[content-type:] = image/gif; name=background.gif 
[content-transfer-encoding:] = base64 [content-disposition:] = inline; 
filename=background.gif [content-id:] = 
4c837ed463ad29c820668e835a270e8a.gif ) [Parts] = Array ( ) [BodyPart] 
= 4 [BodyLength] = 3265 ) ) ) [1] = Array ( [Headers] = Array ( 
[content-type:] = text/plain; name=attachment.txt 
[content-transfer-encoding:] = base64 [content-disposition:] = 
attachment; filename=attachment.txt ) [Parts] = Array ( ) [BodyPart] 
= 5 [BodyLength] = 64 ) ) )


Its pretty confusing and not too sure where to start. any assistance 
would be greatly appreciated.


kind regards

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PHP IMAP with Attachments!?

2007-01-24 Thread Edward Kay
 Hello,
 
 on 10/31/2006 01:36 PM Andy said the following:
 
 
 I need a class that reads emails from a server and reads the
 
 
 attachments from the mail.
 
 
 The mailservers is an IMAP for mail reading.
 
 The attachment types can be: images/pdf/text documents.
 
 Any suggestions?
 
 On phpclasses.org did not find any which works well.
 
 
 
 I think the PHP IMAP extension can do all you need, if you have it
 installed. Otherwise, you can just use pure PHP IMAP client class and
 the use this MIME message parser to extract the message body parts into
 a string or a separate file:
 
 http://www.phpclasses.org/mimeparser
 
 This gets the messages without using the PHP IMAP extension:
 
 http://www.phpclasses.org/imap
 
 
 
 
 Im facing a simliar problem  Im using the mimeparser and the pop3class
 and can see the attachment name but im not sure how to access it and
 save it to a directory of my choice. So far I see the results of the
 array generated after the message has been coded but still not sure how
 to access the attachement. The output is as follows:


I had to solve a similar problem recently and used customised version of
this:

http://uk.php.net/manual/en/function.imap-fetchstructure.php#51497

Edward

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php