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
2010-10-04 19:20:40