NAME

MojoX::Renderer::Mail::Lite - Simple mail renderer for Mojo and Mojolicious through sendmail without prerequires.

Сharset of subject and any data is UTF-8.

Transfer encoding is base64.

SYNOPSIS

#!/usr/bin/perl

use Mojolicious::Lite;
use MojoX::Renderer::Mail::Lite;

app->renderer->add_handler(
  mail => MojoX::Renderer::Mail::Lite->build(
    from => 'sharifulin@gmail.com',
  )
);

get '/simple' => sub {
  my $self = shift;

  $self->render(
    handler => 'mail',

    to      => 'sharifulin@gmail.com',
    subject => 'Тест',
    msg     => 'Привет!',
  );

  $self->render_text('OK');
};

get '/render' => sub {
  my $self = shift;

  $self->render(
    handler => 'mail',

    to      => 'sharifulin@gmail.com',
    subject => 'Тест render',
    msg     => $self->render_partial('render', format => 'mail'),
  );

  $self->render(format => 'html');
} => 'render';

app->start;

__DATA__

@@ render.html.ep
<p>Привет render!</p>

@@ render.mail.ep
Привет render!

METHODS

build

This method returns a handler for the Mojo renderer.

Supported parameters:

  • from

    Default from address

  • sendmail

    Path to sendmail, default value is /usr/sbin/sendmail -t -oi -oem

RENDER

$self->render(
  handler => 'mail',
  
  from    => '...',
  to      => '...',
  cc      => '...',
  bcc     => '...',
  subject => '...',
  msg     => '...',
);

Supported parameters:

  • from

    From address

  • to

    To addresses

  • cc

    Cc addresses

  • bcc

    Bcc addresses

  • subject

    Subject of mail

  • msg

    Data of mail

ENVIROMENT VARIABLES

Module has two env variables:

  • DEBUG

    Print mail, default value is 0

  • TEST

    No send mail, default value is 0

TEST AND RUN

TEST=1 DEBUG=1 PATH_INFO='/render' script/test cgi

SEE ALSO

AUTHOR

Anatoly Sharifulin <sharifulin@gmail.com>

TODO

  • Compatible interface with MojoX::Renderer::Mail

  • Tests

BUGS

Please report any bugs or feature requests to bug-acme-cpanauthors-russian at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.htMail?Queue=MojoX-Renderer-Mail-Lite. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc MojoX::Renderer::Mail::Lite

You can also look for information at:

COPYRIGHT & LICENSE

Copyright (C) 2010 by Anatoly Sharifulin.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.