Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
January 27, 2008, 4:13 am
rate this thread
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
// 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.
Re: Using pop3.class.inc to read email server + retrieve new email + saving attachment
on 01/27/2008 02:13 AM email@example.com said the following:
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:
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:
Take a look at the parse_message.php example of the POP3 class.
PHP professionals looking for PHP jobs
PHP Classes - Free ready to use OOP components written in PHP