Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0

Request #17047 Allow body text to be passed as resource to send()
Submitted: 2010-01-30 23:34 UTC
From: slusarz Assigned: slusarz
Status: Wont fix Package: Mail (version 1.2.0b2)
PHP Version: 5.3.1 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2010-01-30 23:34 UTC] slusarz (Michael Slusarz)
Description: ------------ Mirroring the recent changes to Net_SMTP, a patch to allow body text to be passed as a resource to send().

Comments

 [2010-01-30 23:35 UTC] slusarz (Michael Slusarz)
 [2010-03-08 16:23 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
Since this just reads the entire file resource into memory, how is it better than simply putting a file_get_contents / otherwise doing what the patch is doing outside of the class?
 [2010-03-09 00:41 UTC] slusarz (Michael Slusarz)
Because, without this patch, it is impossible to pass a resource to Net_SMTP. For example, say I have a 10 MB mail message. In Horde, this message is kept in various temporary resources, rather than text, to conserve memory. When it comes time to pass to send(), it is much preferable to send in a resource rather than converting to a string. Not only do you need to convert to a string, IIRC either Mail or Net_SMTP may alter this string resulting in the need for over 20MB+ to be allocated. Additionally, the sendmail driver is also made more efficient. With the new code, with the above example, there should not need to be any additional memory allocated when sending. With the old code, the user not only has to manually covert the resource himself, but will take an additional 10 MB+ hit when converting to a string. This patch only coverts to a memory string for the drivers that don't support resources - nanmely the built-in mail() PHP function. In this case, we are not losing anything since we would need to do this anyway.
 [2011-05-25 22:04 UTC] slusarz (Michael Slusarz)
For the record, we implemented these enhancements in the Horde_Mail library. Passing around data in a stream vastly reduces PHP memory usage - the Mail package is pretty much unusable for large messages if you have a somewhat conservative PHP memory_limit set (e.g. 32 MB).
 [2013-11-06 11:50 UTC] slusarz (Michael Slusarz)
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: slusarz
No use keeping this open. We long since ditched Mail and moved to our Horde_Mail fork due to performance and security concerns.
 [2013-11-06 11:51 UTC] slusarz (Michael Slusarz)
-Status: Closed +Status: Wont fix
This is probably the more correct status.