Re: [Catalyst] Catalyst::View::Email broken?

2008-01-10 Thread Moritz Onken

Hi,

could you also implement a way to put the subject in the template?

Something like (TT):
[% subject = My Subject %]
[% BLOCK content %]
Email content
[% END %]

This makes localization possible for the subject,

when can we expect a new version?

Greets,

Moritz

Am 10.01.2008 um 01:50 schrieb J. Shirley:


On Jan 9, 2008 3:26 PM, Bernhard Graf [EMAIL PROTECTED] wrote:
J. Shirley wrote:

 Hi Bernhard

 Could you file this as an RT bug?  I'm working on the next version
 which will also have attachment support and don't want to miss this.

Done.

But thinking about this module brought me to the conclusion, that it
doesn't buy me anything (besides headaches).

Instead I've put a tiny little send_mail method in MyApp's base class,
that calls Email::MIME::Creator and Email::Send.

Less code that can break (and actually does) and more elegant to say
 $self-send_mail($email_mime_object);
instead of
 $c-stash-{email} = $email_mime_hash;
 $c-forward('View::Email');

--
Bernhard Graf



Thanks for the bug!

I definitely see your point about the simpler send_mail method, and  
I think for a lot of cases it probably is easier that way.  I really  
want to tie into the template rendering process with it, and that  
was my main impetus for writing the module in the first place.


Once I can tie into other views to render attachments, I think it  
will be worth it (An attachment sourced from a PDF View, for  
example).  Until then, it's just slow progression that way.


Thanks for the feedback, though.  If you are just doing a plugin  
cycle, you may want to look at Catalyst::Plugin::Email.


-J
--
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one  
bird...

http://www.toeat.com ___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::View::Email broken?

2008-01-10 Thread J. Shirley
On Jan 10, 2008 1:36 AM, Moritz Onken [EMAIL PROTECTED] wrote:

 Hi,

 could you also implement a way to put the subject in the template?

 Something like (TT):
 [% subject = My Subject %]
 [% BLOCK content %]
 Email content
 [% END %]

 This makes localization possible for the subject,

 when can we expect a new version?

 Greets,

 Moritz

 Am 10.01.2008 um 01:50 schrieb J. Shirley:

  On Jan 9, 2008 3:26 PM, Bernhard Graf [EMAIL PROTECTED] wrote:
  J. Shirley wrote:
 
   Hi Bernhard
  
   Could you file this as an RT bug?  I'm working on the next version
   which will also have attachment support and don't want to miss this.
 
  Done.
 
  But thinking about this module brought me to the conclusion, that it
  doesn't buy me anything (besides headaches).
 
  Instead I've put a tiny little send_mail method in MyApp's base class,
  that calls Email::MIME::Creator and Email::Send.
 
  Less code that can break (and actually does) and more elegant to say
   $self-send_mail($email_mime_object);
  instead of
   $c-stash-{email} = $email_mime_hash;
   $c-forward('View::Email');
 
  --
  Bernhard Graf
 
 
 
  Thanks for the bug!
 
  I definitely see your point about the simpler send_mail method, and
  I think for a lot of cases it probably is easier that way.  I really
  want to tie into the template rendering process with it, and that
  was my main impetus for writing the module in the first place.
 
  Once I can tie into other views to render attachments, I think it
  will be worth it (An attachment sourced from a PDF View, for
  example).  Until then, it's just slow progression that way.
 
  Thanks for the feedback, though.  If you are just doing a plugin
  cycle, you may want to look at Catalyst::Plugin::Email.
 
  -J
  --
  J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one
  bird...
  http://www.toeat.com ___
  List: Catalyst@lists.scsys.co.uk
  Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
  Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
  Dev site: http://dev.catalyst.perl.org/


 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/


Moritz,

That patch isn't likely to go in, since subject belongs in the headers which
is outside of the rendering cycle or that mime-part.  If you want to do
localization of the subject, just do:
  $c-stash-{email}-{subject} = $c-localize(Subject Here);

-J


-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.com
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::View::Email broken?

2008-01-10 Thread Moritz Onken
You could run the code which sends the mail within a template which  
gets post processed.
There you can access subject and content and attachments if you  
like and pass them to the mail function.


the post processed template could check whether subject or content is  
avaiable. if so pass it all together to create the mail. Otherwise use  
the stashed subject and the template output for the mail.


I'd prefer this way because you have all your localization in one place.

Moritz

Am 10.01.2008 um 17:20 schrieb J. Shirley:


On Jan 10, 2008 1:36 AM, Moritz Onken [EMAIL PROTECTED] wrote:
Hi,

could you also implement a way to put the subject in the template?

Something like (TT):
[% subject = My Subject %]
[% BLOCK content %]
Email content
[% END %]

This makes localization possible for the subject,

when can we expect a new version?

Greets,

Moritz

Am 10.01.2008 um 01:50 schrieb J. Shirley:

 On Jan 9, 2008 3:26 PM, Bernhard Graf  [EMAIL PROTECTED]  
wrote:

 J. Shirley wrote:

  Hi Bernhard
 
  Could you file this as an RT bug?  I'm working on the next version
  which will also have attachment support and don't want to miss  
this.


 Done.

 But thinking about this module brought me to the conclusion, that it
 doesn't buy me anything (besides headaches).

 Instead I've put a tiny little send_mail method in MyApp's base  
class,

 that calls Email::MIME::Creator and Email::Send.

 Less code that can break (and actually does) and more elegant to say
  $self-send_mail($email_mime_object);
 instead of
  $c-stash-{email} = $email_mime_hash;
  $c-forward('View::Email');

 --
 Bernhard Graf



 Thanks for the bug!

 I definitely see your point about the simpler send_mail method, and
 I think for a lot of cases it probably is easier that way.  I really
 want to tie into the template rendering process with it, and that
 was my main impetus for writing the module in the first place.

 Once I can tie into other views to render attachments, I think it
 will be worth it (An attachment sourced from a PDF View, for
 example).  Until then, it's just slow progression that way.

 Thanks for the feedback, though.  If you are just doing a plugin
 cycle, you may want to look at Catalyst::Plugin::Email.

 -J
 --
 J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one
 bird...
 http://www.toeat.com ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Moritz,

That patch isn't likely to go in, since subject belongs in the  
headers which is outside of the rendering cycle or that mime-part.   
If you want to do localization of the subject, just do:

  $c-stash-{email}-{subject} = $c-localize(Subject Here);

-J


--
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one  
bird...

http://www.toeat.com ___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::View::Email broken?

2008-01-09 Thread Bernhard Graf
J. Shirley wrote:

 Hi Bernhard

 Could you file this as an RT bug?  I'm working on the next version
 which will also have attachment support and don't want to miss this.

Done.

But thinking about this module brought me to the conclusion, that it 
doesn't buy me anything (besides headaches).

Instead I've put a tiny little send_mail method in MyApp's base class, 
that calls Email::MIME::Creator and Email::Send.

Less code that can break (and actually does) and more elegant to say
  $self-send_mail($email_mime_object);
instead of
  $c-stash-{email} = $email_mime_hash;
  $c-forward('View::Email');

-- 
Bernhard Graf

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::View::Email broken?

2008-01-09 Thread J. Shirley
On Jan 9, 2008 3:26 PM, Bernhard Graf [EMAIL PROTECTED] wrote:

 J. Shirley wrote:

  Hi Bernhard
 
  Could you file this as an RT bug?  I'm working on the next version
  which will also have attachment support and don't want to miss this.

 Done.

 But thinking about this module brought me to the conclusion, that it
 doesn't buy me anything (besides headaches).

 Instead I've put a tiny little send_mail method in MyApp's base class,
 that calls Email::MIME::Creator and Email::Send.

 Less code that can break (and actually does) and more elegant to say
  $self-send_mail($email_mime_object);
 instead of
  $c-stash-{email} = $email_mime_hash;
  $c-forward('View::Email');

 --
 Bernhard Graf



Thanks for the bug!

I definitely see your point about the simpler send_mail method, and I think
for a lot of cases it probably is easier that way.  I really want to tie
into the template rendering process with it, and that was my main impetus
for writing the module in the first place.

Once I can tie into other views to render attachments, I think it will be
worth it (An attachment sourced from a PDF View, for example).  Until then,
it's just slow progression that way.

Thanks for the feedback, though.  If you are just doing a plugin cycle, you
may want to look at Catalyst::Plugin::Email.

-J
-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.com
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Catalyst::View::Email broken?

2008-01-07 Thread Bernhard Graf
I'm unable to create multipart/alternative email with C:V:Email 0.10.

This worked with 0.06:
$stash-{email} = {
header = [ From = $from, To = $to, Subject = $subject],
content_type = 'multipart/alternative',
parts = [
Email::MIME-create(
attributes = {
content_type = 'text/plain',
charset = $cs_plain,
encoding = $enc_plain,
},
body = $plain,
),
Email::MIME-create(
attributes = {
content_type = 'text/html',
charset = $cs_html,
encoding = $enc_html,
},
body = $html,
),
],
}

From how I see the code, it is broken at least in process:

my %mime = ( header = $header );

if ( $parts and ref $parts eq 'ARRAY' ) {
$mime{parts} = $parts;
} else {
$mime{body} = $body;
}

if ( $mime{attributes} and not $mime{attributes}-{charset} and
 $self-{default}-{charset} )
{
$mime{attributes}-{charset} = $self-{default}-{charset};
}

$mime{attributes} is queried here, but never set.
-- 
Bernhard Graf

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/