Il giorno 06/nov/2009, alle ore 22.59, Kevin McArthur ha scritto:
Ralph, normally you'd be right, but since that allocation is 500
megs in one-shot. It should be near the code that is the problem.
Would have to see what he's doing but im guessing a massive
attachment?
There is no attachment in my emails, it is a cli script invoked by a
cronjob that sends a newsletter to about 800 users, each message is
~80KB. The algorithm is this:
1) Fetch users from db
2) Instantiate a Zend_View object
3) Instantiate a Zend_Mail object
4) For each users as u
4.1) Render the view with u as model
4.2) Set to address to u.email
4.3) Set html body to the rendered view
4.4) clear the addresses in the email
end for.
If it was a pecked-to-death-by-ducks thing, you'd see a message
saying "Fatal error: Allowed memory size of 67108864 bytes exhausted
(tried to
allocate 16 bytes) in Unknown on line 0" or something similar, with
a low byte count.
In fact IMHO that's the actual problem, the one-shot allocation (in my
case 130MB, in the other case 500MB).
Looking at the file at line ~284 it appears thats where the email
finally gets sent, and logged. To debug, check the size of $request
at that point. If its huge, you have your error.
I read some code, emails are sent by _sendMail function in
Zend_Mail_Transport_Smtp which calls data method in
Zend_Mail_Protocol_Smtp. This method calls the _send function but it
breaks lines (line 315) so the _send argument should never be huge,
because it's encoded by Zend_Mail and it should be broken in small
lines.
--
Fabio Napoleoni
[email protected]
"Computer Science is no more about computers than astronomy is
about telescopes"
Edsger W. Dijkstra