Thanks for the pointer, t0m!
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.
Wound up doing as you suggested:
use base 'Catalyst::View::TT';
use Email::MIME;
use Mail::Sender; # <= woo hoo!
use Moose;
sub render { ... }
And within render() we purloined chunks of the templating approach
(generate_part) from Catalyst::View::Email::Template in order to still use
the templates approach (one for HTML, one for text).
Works a treat!
On Wed, Dec 21, 2011 at 11:34 AM, Tomas Doran <[email protected]> wrote:
>
> On 20 Dec 2011, at 21:20, will trillich wrote:
>
>> Is there a (straightforward, hopefully :) way to buffer large attachments
>> when generating emails via a Catalyst View?
>>
>
> Yes, in the view code :_)
>
> But you don't mean this, you mean 'in Catalyst::View::Email'
>
>
> If we could use a combination of Template-Toolkit and Email::Stuff which
>> handles buffering nicely (hand it a $FH instead of content, swee-ee-eet)
>> that would be grand. It doesn't look like Email::MIME (which
>> Catalyst::View::Email builds upon) doesn't seem to expect anything other
>> than $body_content.
>>
>
> Time to not be using Catalyst::View::EMail then :)
>
> I'd recommend just sub-classing either your existing (or a new) TT view,
> and using around render => sub {... to do whatever you want with
> Email::Stuff, taking the document you've just rendered with TT, and the
> other attachments and doing the right thing.
>
> Cheers
> t0m
>
>
>
> ______________________________**_________________
> List: [email protected]
> Listinfo:
> http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalyst<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
> Searchable archive: http://www.mail-archive.com/**
> [email protected]/<http://www.mail-archive.com/[email protected]/>
> Dev site: http://dev.catalyst.perl.org/
>
--
"We act as though comfort and luxury were the chief requirements of life,
when all that we need to make us happy is something to be enthusiastic
about." -- Albert Einstein
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/