How do I read/process very large mail files from PHP?
Posted: Tue Apr 10, 2007 10:32 am
Basically, I'm stuck with this and looking for design pointers as much as code help... so any comments / suggestions / out right solutions
will be appreciated
The website I'm currently working on sends out mailings to its opt-in lists. Originally all mailings came from post@domain.com, all the bounces returned to that box. It now has around 1.7 GB of mail in there (6000+ mails) some spam, some bounces.
I have been trying to write a mail processing script that will run off of CRON to access and process, then delete all these mails. Using something like
to handle the stream.
This works fine on the test mail box (with only 10 emails in it), but fails with the error
on the live mailbox.
To compound the issue, they recently changed their protcols so that now, all mailings come from listname@domain.com, so there are now 5 mailboxes to manage in this way.
All I need to do is get access to the mail box, use a preg to find a couple of ID's that should be in the headers (part of the outgoing mail) and then write them to a database, along with the bounce headers. If the code isn't found then its logged as an unknown and deleted.
Any suggestions?
The website I'm currently working on sends out mailings to its opt-in lists. Originally all mailings came from post@domain.com, all the bounces returned to that box. It now has around 1.7 GB of mail in there (6000+ mails) some spam, some bounces.
I have been trying to write a mail processing script that will run off of CRON to access and process, then delete all these mails. Using something like
Code: Select all
$imap = imap_open("{".$server."/pop3:110/notls}INBOX", $user, $pass) or die (imap_last_error());This works fine on the test mail box (with only 10 emails in it), but fails with the error
Code: Select all
POP3 connection broken as responseTo compound the issue, they recently changed their protcols so that now, all mailings come from listname@domain.com, so there are now 5 mailboxes to manage in this way.
All I need to do is get access to the mail box, use a preg to find a couple of ID's that should be in the headers (part of the outgoing mail) and then write them to a database, along with the bounce headers. If the code isn't found then its logged as an unknown and deleted.
Any suggestions?