PHP Classes

Retrieve attached files

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Retrieve attached files  >  (Un) Subscribe thread alerts  
Subject:Retrieve attached files
Summary:saving attached file name in db and download the file onclick
Messages:12
Author:shrishail
Date:2011-01-04 09:10:37
Update:2011-05-24 12:27:30
 
  1 - 10   11 - 12  

  1. Retrieve attached files   Reply   Report abuse  
Picture of shrishail shrishail - 2011-01-04 09:10:37
Hello sir,
Great work on pop mail class!It's very useful.
I need to retrieve the attached file and save it into database.After that i want to fetch it in my application and can download it on click.is there any simple solution to do this .
Thank you.

  2. Re: Retrieve attached files   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-01-06 02:29:15 - In reply to message 1 from shrishail
You need to use this class in conjunction with the MIME parser class.

phpclasses.org/mimeparser

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

  3. browse_mailbox not working for my...   Reply   Report abuse  
Picture of shrishail shrishail - 2011-01-08 06:59:32 - In reply to message 2 from Manuel Lemos
hello sir,
browse_mailbox is working great with my gmail mail id ,it retrives messages one by one.but with my server mailid, i am only able to retrieve only one messsage and it remains same for the next run.

and also i want to make automatic system like when mail comes it fetches the mail and saves the decoded data into database.
Thank u

  4. Re: Retrieve attached files   Reply   Report abuse  
Picture of shrishail shrishail - 2011-01-08 14:40:34 - In reply to message 3 from shrishail
i am getting every message part that i want to display and store in database.
i want to fetch only new mails. how can i do that without deleting the old mails.
The most important is how could i get the attached files to download and save in particular folder,so that i can display in my application.
ex.
suppose mail with attached image.i want to download and store image in my system.
i am not using parameter SaveBody->'/tmp'.I only traverse through decoded array and get all Message parts.i don't know where the attached file is getting stored.
please help me.

  5. Re: Retrieve attached files   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-01-08 17:59:07 - In reply to message 3 from shrishail
That is because you are telling the class to retrieve the same message.

If you read the script you may notice a command that says $message = 1; .

If you do not delete any messages, message 1 will always be the same.

To get other messages you can change the $message variable from 1 to the value of the $messages variable retrieved with Statistics function.

There is no automatic way with POP3 to determine when a message arrives. You need to keep accessing the mailbox regularly to see if is there new mail using for instance cron or your system equivalent.

  6. Re: Retrieve attached files   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-01-08 18:02:31 - In reply to message 4 from shrishail
Attached files are like every message part. If you use SaveBody, the MIME parser class returns the file name of the saved message part. If you do not use SaveBody, the class returns the actual message part data as a string.

  7. Re: Retrieve attached files   Reply   Report abuse  
Picture of shrishail shrishail - 2011-01-11 04:43:13 - In reply to message 6 from Manuel Lemos
thank you very much sir.
now everything is working.i used the savebody parameter,also i seperated the mail types using number of parts available so that i got everything what i was needed.Also attachment is getting saved in another folder by using file rename function.
Gmail provides feature to hide mails once it reads,i am looking for the same for my other mailid.I don't want to delete mail when i pop the mail.How can i do that?

  8. Re: Retrieve attached files   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-01-11 05:07:17 - In reply to message 7 from shrishail
POP3 protocol does not provide any support to mark messages as read. Maybe messages are marked read automatically if you retrieve the whole message.

  9. Re: Retrieve attached files   Reply   Report abuse  
Picture of shrishail shrishail - 2011-01-11 14:14:26 - In reply to message 8 from Manuel Lemos
thanks for instant reply.
i tried with the retrieve message,it does not give me the expected results.i think i should delete the message after downloading the mail.also i set the retrivemessage parameter lines to negative number,resulting same as before.

thank u

  10. Re: Retrieve attached files   Reply   Report abuse  
Picture of victor owino victor owino - 2011-02-01 14:29:16 - In reply to message 3 from shrishail
I have failed to get anything than seeing them on browers..can someone help me on this, what i want is to take adress of the sender,body message and attachment and store them into db..
need help

 
  1 - 10   11 - 12