Using pop3.class.inc to read email server + retrieve new email +

Using pop3.class.inc to read email server + retrieve new email +

am 27.01.2008 05:13:56 von patrice.fiset

Hello, use pop3.class.inc found here (http://www.phpclasses.org/
browse/file/3925.html) to connect to my email server and to retrieve
new emails. The function also look at attachment and save the file on
a folder. Problem, the image files copied on the folder on my web
server, have size of 0k.

Here is the piece of code where I save the attachment (image) in the
folder:

// Give image a unique filename
$rand = md5(uniqid(rand(), 1));
$new_name = $rand.".jpg";

// Save image!
$image = fopen( $new_name, "wb" );
fwrite( $image, base64_decode( $file ) );
fclose( $image );

Anyone who used pop3.class.inc know what's wrong with this?

Thanks for your help.

Mc

Re: Using pop3.class.inc to read email server + retrieve new email+ saving attachment

am 27.01.2008 06:21:24 von Manuel Lemos

Hello,

on 01/27/2008 02:13 AM patrice.fiset@gmail.com said the following:
> Hello, use pop3.class.inc found here (http://www.phpclasses.org/
> browse/file/3925.html) to connect to my email server and to retrieve
> new emails. The function also look at attachment and save the file on
> a folder. Problem, the image files copied on the folder on my web
> server, have size of 0k.
>
> Here is the piece of code where I save the attachment (image) in the
> folder:
>
> // Give image a unique filename
> $rand = md5(uniqid(rand(), 1));
> $new_name = $rand.".jpg";
>
> // Save image!
> $image = fopen( $new_name, "wb" );
> fwrite( $image, base64_decode( $file ) );
> fclose( $image );
>
> Anyone who used pop3.class.inc know what's wrong with this?

I have never used that class. You may need to ask the author directly.

I used this other POP3 client class which comes with an useful stream
that lets you open messages in your mailbox with the fopen() as if they
were regular files using filenames like this:

pop3://user:password@pop3.server.com/message_id

http://www.phpclasses.org/pop3class

If you want to extract any attachements or any other types of message
parts, you can pass message stream file name to this other MIME parser
class, which parses the messages and can save message parts to files in
a given directory:

http://www.phpclasses.org/mimeparser

Take a look at the parse_message.php example of the POP3 class.

--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/