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

Request #16962 dataFromFile() for very big messages support
Submitted: 2009-12-31 17:53 UTC
From: alec Assigned: jon
Status: Closed Package: Net_SMTP (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2009-12-31 17:53 UTC] alec (Aleksander Machniak)
Description: ------------ Currently it's not possible to send a very big message, let's say 500MB, because PHP's memory_limit. It would be nice to have a function to read message data from file and send it line by line.

Comments

 [2010-01-03 12:31 UTC] jon (Jon Parise)
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: jon
I'd be happy to consider a patch that implements the requested behavior. I think the Net_Socket package would also require an update. It currently expects its outbound data as a string (rather than a stream), so that interface would need to be extended/improved before the Net_SMTP package could make use of it.
 [2010-01-04 13:06 UTC] alec (Aleksander Machniak)
I think we can do this without Net_Socket change, simply sending data line by line using _send(). Do we? $handle = fopen("file", "r"); // here sent DATA ... // now file content while (!feof($handle)) { $data = fgets($handle, 1024); if ($data ===false) return "read error"; $this->quotedata($data); if (PEAR::isError($result = $this->_send($data))) { return $result; } } fclose($handle); // and here "\r\n.\r\n" ...
 [2010-01-08 11:34 UTC] jon (Jon Parise)
Yes, I think something like that will work. I think the best API would be to expand the current data() method to accept the $data parameter as either a string or a file resource. In the second case, the caller would be responsible for opening and closing the file handle.
 [2010-01-08 12:12 UTC] jon (Jon Parise)
-Status: Analyzed +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Have a look at what I just implemented in SVN.
 [2010-01-08 12:13 UTC] alec (Aleksander Machniak)
-Status: Closed +Status: Analyzed
But you cannot call filesize() on file handle. We need it for SIZE check.
 [2010-01-08 12:16 UTC] alec (Aleksander Machniak)
I've forgot about fstat, looks good to me now. Will test.
 [2010-01-10 23:56 UTC] jon (Jon Parise)
-Status: Analyzed +Status: Feedback
How are things working for you?
 [2010-01-15 17:42 UTC] alec (Aleksander Machniak)
It's working. I think you can make a new release.
 [2010-01-18 03:56 UTC] jon (Jon Parise)
-Status: Feedback +Status: Closed
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/