[Catalyst] Catalyst generating emails -- how to buffer large attachments?

Dave Rolsky autarch at urth.org
Mon Dec 26 18:30:01 GMT 2011


On Fri, 23 Dec 2011, will trillich wrote:

> We switched to Mail::Sender -- it opens a connection to the SMTP server immediately, and pipes the output generating on -the-fly, instead of
> accumulating beaucoup megabytes in RAM to then ship off the whole thing at once.

This is really not a great idea. The sendmail binary will take the message 
and queue it if the SMTP server isn't available immediately, so uses it 
helps make your app less sensitive to problems with the mail daemon. If 
you don't do this then you're stuck handling retrying logic in your app.

There's no reason not to just stream the output to the sendmail binary.

Rjbs has talked about adding a stream_to interface to Email::Abstract (and 
Email::{Simple,MIME}) which would make this a lot cleaner. I'm sure he'd 
welcome patches.

Courriel already supports a stream_to() API, but you'd need to write your 
own implementation of email parts which are stored on disk. This probably 
wouldn't too hard to implement, though.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/



More information about the Catalyst mailing list