The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Egg::View::Mail::Base - Base class for MAIL controller.

SYNOPSIS

  package MyApp::View::Mail::MyController;
  use base qw/ Egg::View::Mail::Base /;
  
  __PACKAGE__->config( ...... );
  
  __PACKAGE__->setup_mailer( SMTP => qw/ MIME::Entity / );

DESCRIPTION

It is a base class to succeed to from the MAIL controller who generates it in the helper script.

see Egg::Helper::View::Mail.

METHODS

In addition, Egg::Base and Egg::Component have been succeeded to.

setup_plugin ([PLUGIN_LIST])

It is made to use by building the plug-in into the MAIL controller. The name that omits the part of 'Egg::View::Mail::Plugin' is passed to PLUGIN_LIST by the list.

  __PACKAGE__->setup_plugin(qw/
     PortCheck
     Signature
     /);

There is a thing that the competition of the method is generated by the built-in order, it doesn't operate normally, and the result of the expectation is not obtained. Please adjust the built-in order to solve it.

setup_mailer ([MAILER_NAME] => [COMP_LIST])

The component that does processing that actually transmits mail is built in.

Egg::View::Mail::Mailer::CMD and Egg::View::Mail::Mailer::SMTP are included in this package.

The name that omits the part of 'Egg::View::Mail::Mailer' to MAILER_NAME is passed.

  __PACKAGE__->setup_mailer('SMTP');

In addition, other components can be specified for COMP_LIST if necessary. Please pass the name that omits the part of 'Egg::View::Mail' by the list.

  __PACKAGE__->setup_mailer( CMD => qw/
     MIME::Entity
     Encode::ISO2022JP
     / );

There is a thing that the competition of the method is generated by the component as well as 'setup_plugin'.

setup_template ( [VIEW_LABEL] => [DEFAULT_TEMPLATE] )

When the content of mail is generated with a template, the template used by the template engine and default is set.

   __PACKAGE__->setup_template( Mason => 'mail/text.tt' );

The argument and the configuration passed to 'send' method are set in the parameter of the template engine. It is possible to access it by '$p' from among the template engine.

  To Address   : <% $p->{to} %>
  From Address : <% $p->{from} %>

send ([MAIL_DATA_HASH])

It prepares, and transmit mail processing is passed to 'mail_send' method of Mailer system component.

MAIL_DATA_HASH overwrites the configuration.

Therefore, the item that can be specified becomes it as well as the configuration.

'body' or 'template' is always necessary. However, this is not necessary if the template of default is set by 'setup_template' either.

  $mail->send( body => <<END_BODY );
  Will the movie go to see ?
  END_BODY
  
     Or
  
  $mail->send( template => 'mail.tt' );

The SCALAR reference and ARRAY can be passed to 'body'.

  # Changing line enters between each element when passing it with ARRAY.
  $mail->send( body => [qw/ Will the movie go to see ? /] );
  
  # If you pass it by the SCALAR reference ...
  $mail->send( body => \"Will the movie go to see ?\n" );

create_mail_data (MAIL_DATA_HASH)

The data to do Mail Sending is made.

After merging MAIL_DATA_HASH with the configuration and making the content of the transmission, this method returns the data.

create_mail_body (MAIL_DATA_HASH)

The content of the transmission including the mail header is returned.

The processing of this method is not practicable. Please build in Egg::View::Mail::MIME::Entity.

create_mail_header (MAIL_DATA_HASH)

A basic mail header is returned.

SEE ALSO

Egg::Release, Egg::Base, Egg::Component, Egg::View::Mail, Egg::View::Mail::MIME::Entity, Egg::Helper::View::Mail,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.