save IMAP emails to MySQL database
Posted: Wed Nov 24, 2010 11:06 pm
I am trying to create a script that inserts emails into a MySQL database and copies the attachments to a folder...
I've googled and scoured this forum 'til my fingers are sore.... still nothing helpful!
I know how to open an IMAP connection and get a list of the emails in the mailbox... but want I want to do is a little more complicated...
-Open the mailbox (as I said, I know how to do this)
-open the emails in the mailbox, save the from address, subject, timestamp and body to a MySQL database
-copy the attachment (if any) to a folder
-delete the email if the MySQL insert/file copy worked fine
-loop back and do this for any other emails that may be in the mailbox
can anyone shed some light?
from the research I have done, I would need to use imap_list, imap_body, imap_headerinfo, imap_delete and of course the usual MySQL INSERT query
this is my first time playing with IMAP, so any an explanation of any code, or further suggestions would be more than appreciated! =D
I've googled and scoured this forum 'til my fingers are sore.... still nothing helpful!
I know how to open an IMAP connection and get a list of the emails in the mailbox... but want I want to do is a little more complicated...
-Open the mailbox (as I said, I know how to do this)
-open the emails in the mailbox, save the from address, subject, timestamp and body to a MySQL database
-copy the attachment (if any) to a folder
-delete the email if the MySQL insert/file copy worked fine
-loop back and do this for any other emails that may be in the mailbox
can anyone shed some light?
from the research I have done, I would need to use imap_list, imap_body, imap_headerinfo, imap_delete and of course the usual MySQL INSERT query
this is my first time playing with IMAP, so any an explanation of any code, or further suggestions would be more than appreciated! =D