Jaiane has asked for the wisdom of the Perl Monks concerning the following question:

hi, guys, I'm trying configure an email in my Catalyst aplication using this view, but the subject is not encoding. # traximud.yml
name: TaxiMud default_view: TT View::Email::Template: stash_key: enviar_email default: content_type: text/plain charset: utf-8 to: kermeson@gmail.com view: TT sender: mailer: SMTP
# **** My controller ****#
sub enviar_orcamento: Local { my ( $self, $c ) = @_; my $subject = encode('UTF-8','Pedido de Orçamento'); $c->stash->{enviar_email} = { to => 'kermeson@gmail.com', from => $c->req->param('email_origem'), template => 'orcamento/enviado.tt', subject => $subject, content_type => 'text/html', }; $c->forward( $c->view('Email::Template') ); if ($c->error) { $c->stash->{erro} = join ' ', @{$c->error}; $c->error(0); } }
Could you help me give some idea... thanks

Replies are listed 'Best First'.
Re: Configuring Email with View::Email::Template
by almut (Canon) on Oct 08, 2008 at 20:35 UTC

    The encoding of the message body and the mail headers are two different kind of things. The latter is specified in RFC 2047.

    Although I know next to nothing about View::Email::Template, I think you should try

    my $subject = encode('MIME-Header', 'Pedido de Orçamento');

    which would create an RFC 2047 compliant subject line (provided it is fed a properly encoded (UTF-8) input string).  As this thread seems to indicate (I confess I only skimmed it, so I could be wrong), this type of header encoding is currently not being done automagically.