Ok… currently implementing… so here’s some first remarks/doubts/questions:
1)
$e->get_timestamp() returns the timestamp the message was sent.
How can I get the timestamp when the message was received/pulled? I’m just using time() now, but I believed imap_pop class had this?
2)
What’s the best way to get all mail? Here’s how I’m doing it right now:
if ($this->peeker->message_waiting()){ // there is at least one message
$message_count = $this->peeker->get_message_count(); // count them
if($message_count > 50 ){ $message_count = 50; } // do not get more that 50 messages on each pull, to avoid mem/timeout trouble
$ems = $this->peeker->get_message('1', $message_count); // get messages
if( $this->config->item('mail_delete') == true) {
$this->peeker->delete_and_expunge('1:'.$message_count ); // delete retrieved messages from server
}
$this->peeker->close();
}
Considered a while(get_message()){} instead… but it would probably the same in terms of performance, with the downside of not being able to limit the number of messages?
3)
This is also very time consuming to test/debug because, even if I dont delete the messages, they are never retrieved again. Is there a way to use get_message() without marking them as already retrieved/read by the server?
4)
get_message() accepts two params (used to be a range on previous imap_pop class?)... but delete_and_expunge() takes a range as param? Isn’t that a bit inconsistent? It got me kinda confused at first.
5)
I’m trying to save all email attachments and noticed that save_all_attachments() will save all files, already using fingerprint as the dir (which is perfect!) and will do this for ALL files/attachments with or without disposition. However…get_file_name_array() only seems to show the attachments without disposition!
I could sure use some pointers as to what the best way is to get the filenames, to save on the database, for later easy deletion.
Would also be nice to have these dirs and files set with different chmod/chown. Right now I can only delete them as root and/or by changing their permissions, since fingerprint dirs are 755 and files 644 owned by www-data (only the web server can delete them).
Letting them be executable might be a serious security risk though (I am thinking malicious_script.php and .htaccess attachments). Any ideas?
