views:

19

answers:

1
+1  A: 

Without having used Pear::Mail_Mime I'd bet you run out of memory because you create a brand new Mail_Mime() object on every loop iteration, when it seems like it's the same in all of them.

Create as few as possible, taking it out of the outermost foreach.

Same for $mail. You can probably re-use the same $mail object and feed it new headers and body.

To make sure where your memory is used, surround the suspect lines with memory_get_usage() and log its output to see the increase.

Fanis
That's great. Consider adding your new working code to your question for a more complete look, instead of having it in an answer on its own.
Fanis